Created
May 28, 2020 01:09
-
-
Save peci1/979fd510d82a99a784d5996d6d93c93a to your computer and use it in GitHub Desktop.
Syslog NG config for Turris Omnia which saves important parts of the logs to NAS. Date is also unified to a single timezone for all messages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@version:3.19 | |
options { | |
chain_hostnames(no); | |
flush_lines(0); | |
stats_freq(0); | |
flush_lines(0); | |
log_msg_size(65536); | |
}; | |
source src { | |
internal(); | |
unix-dgram("/dev/log" flags("expect-hostname")); | |
}; | |
source kernel { | |
file("/proc/kmsg" program_override("kernel")); | |
}; | |
filter f_turris_iptables { | |
not match(".*turris[^:]*: .*" value(MESSAGE) type("pcre")) or not level(debug); | |
}; | |
filter f_not_mountd_error { | |
not match(".*could not find a serial number for the device sda.*" value(MESSAGE)); | |
}; | |
filter f_not_odhcp6 { | |
not match(".*Failed to send DHCPV6 message to ff02::1:2.*" value(MESSAGE)); | |
}; | |
filter f_not_odhcpd { | |
not match(".*A default route is present but there is no public prefix.*" value(MESSAGE)); | |
}; | |
filter f_not_odhcp6_rs { | |
not match(".*Failed to send RS .Permission denied..*" value(MESSAGE)); | |
}; | |
filter f_not_nikola_info { | |
not program("nikola") or not level(info); | |
}; | |
filter f_not_cron { | |
not program("cron"); | |
}; | |
filter f_not_debug { | |
not level(debug); | |
}; | |
filter f_not_ucollect_info { | |
not program("ucollect") or not level(info); | |
}; | |
filter f_not_kresd_info { | |
not program("kresd") or not level(info); | |
}; | |
filter f_not_nethist_info { | |
not program("nethist") or not level(info); | |
}; | |
filter f_not_firewall_rules { | |
not program("turris-firewall-rules") or not level(info); | |
}; | |
destination messages { | |
file("/var/log/messages" suppress(5) template("${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:${R_MIN}:${R_SEC} ${PRIORITY} ${PROGRAM}[${PID}]: ${MSGONLY}\n") log_fifo_size(256)); | |
}; | |
destination nas { | |
file("/mnt/nas/data/omnia-logs/${R_YEAR}/${R_MONTH}/messages-${R_YEAR}${R_MONTH}${R_DAY}.log" create-dirs(yes) dir-owner(root) owner(root) dir-perm(0755) perm(0755) suppress(5) template("${R_HOUR}:${R_MIN}:${R_SEC} ${PRIORITY} ${PROGRAM}[${PID}]: ${MSGONLY}\n") log_fifo_size(256)); | |
}; | |
log { | |
source(src); | |
source(kernel); | |
filter(f_turris_iptables); | |
filter(f_not_mountd_error); | |
filter(f_not_odhcp6); | |
filter(f_not_odhcpd); | |
destination(messages); | |
}; | |
log { | |
source(src); | |
source(kernel); | |
filter(f_turris_iptables); | |
filter(f_not_mountd_error); | |
filter(f_not_cron); | |
filter(f_not_odhcp6); | |
filter(f_not_odhcpd); | |
filter(f_not_nikola_info); | |
filter(f_not_debug); | |
filter(f_not_odhcp6_rs); | |
filter(f_not_ucollect_info); | |
filter(f_not_kresd_info); | |
filter(f_not_nethist_info); | |
filter(f_not_firewall_rules); | |
destination(nas); | |
}; | |
@include "/etc/syslog-ng.d/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment