Pouco antes de postar esta pergunta eu mudei:
/etc/rsyslog.d/mikrotik.conf
para:
/etc/rsyslog.d/10-mikrotik.conf
Consertou o meu problema, mas descobri agora.
Eu configurei meu servidor ubuntu como servidor syslog para aceitar todos os meus logs do meu roteador e salvá-los em um arquivo mikrotik.log separado na pasta / var / log /.
Tudo funciona, mas percebo que todas as mensagens também são copiadas nos arquivos de log do / var / syslog.
Existe uma maneira de eu parar de ter essas mensagens de roteador no meu log de / var / syslog?
Abaixo estão meus arquivos de configuração para o syslog:
/etc/rsyslog.d/10-mikrotik.conf
$template RouterLog, "/var/log/mikrotik.log"
:fromhost-ip, isequal, "192.168.2.1" -?RouterLog
& stop
/etc/rsyslog.d/50-default.conf
# Default rules for rsyslog.
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#
# Logging for INN news system.
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Emergencies are sent to everybody logged in.
#
*.emerg :omusrmsg:*
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
/etc/rsyslog.conf
# /etc/rsyslog.conf Configuration file for rsyslog.
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imklog # provides kernel logging support
#$ModLoad immark # provides --MARK-- message capability
# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
# provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514
# Enable non-kernel facility klog messages
$KLogPermitNonKernelFacility on
###########################
#### GLOBAL DIRECTIVES ####
###########################
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Filter duplicated messages
$RepeatedMsgReduction on
#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog
#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
Pouco antes de postar esta pergunta eu mudei:
/etc/rsyslog.d/mikrotik.conf
para:
/etc/rsyslog.d/10-mikrotik.conf
Consertou o meu problema, mas descobri agora.
tente adicionar essa linha imediatamente após as regras que você não duplicou.
& ~
por exemplo. edite /etc/rsyslog.d/10-mikrotik.conf
para parecer
$template RouterLog, "/var/log/mikrotik.log"
:fromhost-ip, isequal, "192.168.2.1" -?RouterLog
# & stop
& ~
Isso deve impedir que uma cópia das mensagens de log continue para /var/log/syslog
Então, é claro, execute service rsyslog restart