Answer the question
In order to leave comments, you need to log in
RSYSLOG - how to separate logs using filtering?
My Mikrotik sends logs to the server via the Rsyslog service. Logs are being maintained, everything is fine. But there was a need to separate the log into files. For example - logs are collected at events: WiFi, PPPoE, Hotspot.
You need to make sure that Hotspot is collected in a separate file.
All logs are collected according to the template
$template ALL, "/var/log/!remote/%fromhost-ip%/syslog.log"
*.* ?ALL
I registered a filter, but something does not work.
$template HOTSPOT, "/var/log/!remote/%fromhost-ip%/hotsopt.log"
if $msg contains 'Hotspot' then *.* ?HOTSPOT
Answer the question
In order to leave comments, you need to log in
Well here are some examples.
# Все от программы ntpdate в файл /var/log/ntpdate
if $programname == 'ntpdate' then /var/log/ntp
# все остальное в файл /var/log/daemon
if $programname != 'ntpdate' \
and $syslogfacility-text == 'daemon' then /var/log/daemon
# Сообщения MARK в файл /var/log/marks
if $msg == '-- MARK --' then /var/log/marks
# остальные в /var/log/kernel
if $msg != '-- MARK --' \
and $syslogfacility-text == 'kern' then /var/log/kernel
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question