[syslog-ng] facility(kern) not working? Syslog-ng 2.0.7

joël Winteregg joel.winteregg at gmail.com
Mon Nov 17 14:02:01 CET 2008


Hello,

Have you tried to define your filter as: program("kernel")

I am not sure if /proc/kmsg provide a facility code (PRI) with its logs.
In your case the program field seems to be set as "kernel":
 file ("/proc/kmsg" log_prefix("kernel: "));

So the above filter (based on the program field) should help...

Hope its help.

Joël


On Mon, 2008-11-17 at 12:46 +0000, Fegan, Joe wrote:
> Hi,
> 
> I am using 2.0.7 and it seems that facility(kern) does not match messages from "logger -p kern.info". I am trying to filter kernel messages into a file but nothing goes there. Below are details of the test.
> 
> Joe.
> 
> [root at node1 ~]# cat /etc/syslog-ng/syslog-ng.conf
> options {
>     sync (0);
>     time_reopen (10);
>     log_fifo_size (1000);
>     long_hostnames (off);
>     use_dns (no);
>     use_fqdn (no);
>     create_dirs (no);
>     keep_hostname (yes);
>     stats_freq(2592000);
>     mark_freq(0);
> };
> 
> source s_sys {
>     file ("/proc/kmsg" log_prefix("kernel: "));
>     unix-stream ("/dev/log");
>     internal();
>     # udp(ip(0.0.0.0) port(514));
>     # tcp(ip(0.0.0.0) port(514));
> };
> 
> template t_withsev {
>   template("${DATE} ${HOST} ${PRI} ${PRIORITY} ${MSG}\n");
> };
> 
> destination d_klog { file("/var/log/klog"); };
> destination d_mesg { file("/var/log/messages" template(t_withsev)); };
> destination d_auth { file("/var/log/secure"); };
> destination d_mail { file("/var/log/maillog" sync(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_mlal { usertty("*"); };
> 
> filter f_filter1   { facility(kern); };
> filter f_filter2   { level(info..emerg) and
>                      not facility(mail,authpriv,cron); };
> filter f_filter3   { facility(authpriv); };
> filter f_filter4   { facility(mail); };
> filter f_filter5   { level(emerg); };
> filter f_filter6   { facility(uucp) or
>                      (facility(news) and level(crit..emerg)); };
> filter f_filter7   { facility(local7); };
> filter f_filter8   { facility(cron); };
> 
> log { source(s_sys); filter(f_filter1); destination(d_klog); };
> log { source(s_sys); filter(f_filter2); destination(d_mesg); };
> log { source(s_sys); filter(f_filter3); destination(d_auth); };
> log { source(s_sys); filter(f_filter4); destination(d_mail); };
> log { source(s_sys); filter(f_filter5); destination(d_mlal); };
> log { source(s_sys); filter(f_filter6); destination(d_spol); };
> log { source(s_sys); filter(f_filter7); destination(d_boot); };
> log { source(s_sys); filter(f_filter8); destination(d_cron); };
> 
> [root at node1 ~]# logger -i -p kern.info "hello from kern"
> [root at node1 ~]# tail -2 /var/log/messages
> Nov 17 12:40:45 dizzyfive1 189 notice syslog-ng: syslog-ng startup succeeded
> Nov 17 12:41:40 dizzyfive1 14 info root[19336]: hello from kern
> [root at node1 ~]# ls -l /var/log/klog
> ls: /var/log/klog: No such file or directory
> [root at node1 ~]#
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
> FAQ: http://www.campin.net/syslog-ng/faq.html
> 



More information about the syslog-ng mailing list