问题原文
原帖链接 · mistyrouge · CC BY-SA 3.0
I have several applications and scripts that I want to redirect the output to custom files.
I launch those applications using
command | logger -t TAG
I would like to filter these messages based on their tags and redirect them to different files. I don't want to use bash redirection as those applications are mainly long running process and need proper log rotation.
I have tried to add a custom filter in /etc/rsyslog.d/60-myfilter.conf ;
if $syslogtag == 'giomanager' then /var/log/giomanager.log
What am I doing wrong ? What is the proper way to filter based on the tag or is there a better option to have similar result?
已采纳解答
原帖链接 · mistyrouge · CC BY-SA 3.0
So I finally found a solution to my problem.
Thank you very much to @lain for leading my way.
The solution as stated before is to include a ':' in the tag name. Also, and this is very important, the file name must be before 50-default.conf in alphabetical order.
To resume, put the following in 30-giomanager.conf :
:syslogtag, isequal, "giomanager:" /var/log/giomanager.log
& stop
Note that the file /var/log/giomanager.log should be writable by the 'syslog' user.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
