Collection of logs is an important task if your company works with some kind of user data on-premise. And logging and monitoring of networking devices are also important. In this article, I will show how to set up Syslog on Meraki and using syslog-ng to receive those logs on to your logging server.
First, let’s start with enabling the Syslog feature on the Meraki dashboard.
- Network-wide -> General -> Reporting -> Syslog Server. Add logging server ip address and port.
- Install syslog-ng on to the logging server. (sudo apt-get install syslog-ng)
- Edit configuration for syslog-ng to listen 0.0.0.0 to port 514. Config file: /etc/syslog-ng/syslog-ng.conf. It will grab any Syslog sent to this server.
source s_sys {
system();
internal();
udp(ip(0.0.0.0) port(514));
};
4. Now define destination file to save the logs coming into the logging server.
destination d_meraki { file("/var/log/meraki.log"); };
5. Define filters to save the log file the way you want.
filter f_meraki { facility(meraki); };
6. Now define everything together in the log section to make it sensible configuration.
log { source ( s_sys ); filter( f_meraki ); destination ( d_meraki ); };
7. Save the file and restart Syslog-ng.
systemctl syslog-ng restart
Final file will look something like this:
@version:3.5
@include "scl.conf"
# syslog-ng configuration file.
#
# This should behave pretty much like the original syslog on RedHat. But
# it could be configured a lot smarter.
#
# See syslog-ng(8) and syslog-ng.conf(5) for more information.
#
# Note: it also sources additional configuration files (*.conf)
# located in /etc/syslog-ng/conf.d/
options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
chain_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (yes);
};
source s_sys {
system();
internal();
udp(ip(0.0.0.0) port(514));
};
destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog" flush_lines(10)); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_kern { file("/var/log/kern"); };
destination d_mlal { usertty("*"); };
destination d_meraki { file("/var/log/meraki.log"); };
filter f_kernel { facility(kern); };
filter f_default { level(info..emerg) and
not (facility(mail)
or facility(authpriv)
or facility(cron)); };
filter f_auth { facility(authpriv); };
filter f_mail { facility(mail); };
filter f_emergency { level(emerg); };
filter f_news { facility(uucp) or
(facility(news)
and level(crit..emerg)); };
filter f_boot { facility(local7); };
filter f_cron { facility(cron); };
filter f_meraki { facility(meraki); };
#log { source(s_sys); filter(f_kernel); destination(d_cons); };
log { source(s_sys); filter(f_kernel); destination(d_kern); };
log { source(s_sys); filter(f_default); destination(d_mesg); };
log { source(s_sys); filter(f_auth); destination(d_auth); };
log { source(s_sys); filter(f_mail); destination(d_mail); };
log { source(s_sys); filter(f_emergency); destination(d_mlal); };
log { source(s_sys); filter(f_news); destination(d_spol); };
log { source(s_sys); filter(f_boot); destination(d_boot); };
log { source(s_sys); filter(f_cron); destination(d_cron); };
log { source ( s_sys ); filter( f_meraki ); destination ( d_meraki ); };
# Source additional configuration files (.conf extension only)
@include "/etc/syslog-ng/conf.d/*.conf"
# vim:ft=syslog-ng:ai:si:ts=4:sw=4:et:
You can use different SIEM and get output in a proper indexed format. My next post will show you how to get this log into ELK stack.