In some situations, you might need to save logs for record / tracking purpose regarding Mikrotik Actions and users connectivity. Its much easier to intercept info using Linux base logs. Following is an simple article explaining you howto send Mikrotik logs to remote Ubuntu/Linux base syslog server.
# MIKROTIK CONFIGURATION
In Mikrotik, Open Terminal & paste the following.
1
2
3
4
| /system logging actionset
remote bsd-syslog=yes name=remote remote=192.168.2.1 remote-port=514
src-address=0.0.0.0 syslog-facility=local0 syslog-severity=auto
target=remote/system loggingadd action=remote disabled=no prefix="" topics=!async |
That’s it for Mikrotik
# UBUNTU/LINUX CONFIGURATION
If you already don’t have syslog server installed, install it by
1
| apt-get install syslogd |
1
| nano /etc/syslog.conf |
1
2
3
| !*+192.168.2.10local0.* /var/log/mt.log |
Now Save & Exit.
Create a new file by touch command so that syslog can store Mikrotik logs in separate file.
1
2
| touch /var/log/mt.logchmod 600 /var/log/mt.log |
1
| /etc/init.d/sysklogd restart |
1
| tail -f /var/log/mt.log |
TIPS N TRICKS
You can also setup one CENTRAL LOG SERVER, and collected all server’s /devices logs in this server for better troubleshooting/monitoring and management purposes. Just search in google for SYSLOG
Howto Prevent Duplicate LOG Entries
By Default there will be duplicate entries for mikrotik logs in /var/log/mt.log & /var/log/messagesTo prevent duplicate entries, you have to tell syslog to ignore local0.* to be placed in /var/log/messages. To do this, you have to add an entry ‘local0.none’ in the following section in /etc/syslog.conf
Look for following Lines
1
| mail,news.none -/var/log/messages |
1
2
| mail,news.none;\local0.none -/var/log/messages |
SAVE LOGS IN MIKROTIK (Personnel Reference)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #Logging features, I used this to store necessary info of Mikrotik# written to DISK for record purpose./system logging actionset memory memory-lines=100 memory-stop-on-full=no name=memory target=memoryset disk disk-file-count=14 disk-file-name=MyMikrotik-log disk-lines-per-file=10000 disk-stop-on-full=no name=disk target=disk/system loggingadd action=memory disabled=no prefix="" topics=info,!firewalladd action=echo disabled=no prefix="" topics=erroradd action=echo disabled=no prefix="" topics=warningadd action=echo disabled=no prefix="" topics=criticaladd action=remote disabled=no prefix="" topics=firewalladd action=disk disabled=no prefix="" topics=pppoe,ppp,infoadd action=disk disabled=no prefix="" topics=criticaladd action=disk disabled=no prefix="" topics=system,infoadd action=disk disabled=no prefix="" topics=pppoe,info |
Regard’s
naveed ahmad





0 comments:
Post a Comment