script to save logs and send via email

logging:
/system logging action
set 1 disk-file-count=20 disk-file-name=/usb1/log disk-lines-per-file=2000regular script for sending:
/tool e-mail send to=“my.email” subject=([/system identity get name] .
" SystemLog") from=my.device.email file=usb1/log.0.txtHave you read your error message posted here?? it says that script with such name already exists…

I’ve just found this post, seems nice, but how do you do deal with duplicate or missing stuff?

for example, let’s suppose I run your script daily, and there were few entries in the log, I’ll see the same log twice. Instead if there were too many entries, maybe I’ll just see log.0 but in the meanwhile there was another log.1 I will not see.
But, honestly, I’ve seen that implementing something like a log rotation and check to send only new logs becomes rapidly too much complicated and errors prone… Maybe I could just send file every two hour, and suppose I’ll never log more than 1000 lines/hour :slight_smile:

Again, is there a way to send email IMMEDIATELY for certain events, for example admin logins? There’s a log target “email”, but there are no examples on it…

You never can presume how the log will look like. If the logging is really essential you should run logserver and log from devices directly to it.
I remember that there were some script published here that was able to parse the log records and do actions according the log content. Search a bit.

Yes, but if you are using your script above, how do you deal with it? How often do you send your file? thank you

I send emails with log file daily. Also exports and backups each two days. Parallely I use logserver in dude online. I am not so much interested in the content of logs just checking if it works correctly because sometimes the logging to disk stops without any other notice. So I mainly check if the incoming file has recent lines.

Hi

we have some hotspots running under RB951UI2HND (v 6.3) and we need to save all sites visited by our users and keep it 3 months (terrorism law)
could you please advise the exact script to run it

Thanks

To Analyse use Libre Office from Apache, free and very easy to use !

This script stopped working with version 6.42.1 - changelog to 6.42.2 does not show any fix. I will give it a try, but anybody else having same issue?