On 20/02/2014 10:14, krid wrote:
[color=blue]
here my Steps to save the Logfiles on th syslog-ng server.
1.Step i put simple lines in the syslog-ng
Code:
source s_router { udp( port(514)); };
destination d_router { file(“/var/log/router/$HOST.log” owner(root) group(users) perm(0640)); };
log { source(s_remote); destination(d_router); };
The goal was one Logfile with the DNS name. The Problem is that this
Router have 2 DNS Entrys. If i restart the syslog-ng service the name of
the logfile is changing, i have the same result if i use logrotate… Now
i have 2 logfiles for 1 router. This is the reason that i will use the
ip address in the name of the logfile!
Code:
source s_router { udp( port(514)); };
destination d_router { file(“/var/log/router/10_0_0_1” owner(root) group(users) perm(0640)); };
log { source(s_remote); destination(d_router); };
Now i have one logfile for my router! Thats work’s great.
But now i have 2 more router!
I expand the lines above:
Code:
source s_router { udp( port(514)); };
destination d_router01 { udp( (ip “10.0.0.1”) port(514)); file(“/var/log/router/10_0_0_1” owner(root) group(users) perm(0640)); };
destination d_router02 { udp( (ip “10.0.0.2”) port(514)); file(“/var/log/router/10_0_0_2” owner(root) group(users) perm(0640)); };
destination d_router03 { udp( (ip “10.0.0.3”) port(514)); file(“/var/log/router/10_0_0_3” owner(root) group(users) perm(0640)); };
log { source(s_remote); destination(d_router01); };
log { source(s_remote); destination(d_router02); };
log { source(s_remote); destination(d_router03); };
Now the result is that i have 3 logfiles, with the same content!
For this reason i expand the syslog-ng.conf with the filter option:
Code:
source s_router { udp( port(514)); };
destination d_router01 { file(“/var/log/router/10_0_0_1” owner(root) group(users) perm(0640)); };
destination d_router02 { file(“/var/log/router/10_0_0_2” owner(root) group(users) perm(0640)); };
destination d_router03 { file(“/var/log/router/10_0_0_3” owner(root) group(users) perm(0640)); };
filter f_router01 { host(“10.0.0.1”); };
filter f_router01 { host(“10.0.0.2”); };
filter f_router01 { host(“10.0.0.3”); };[/color]
For starters you’ve defined f_router01 three times and not f_router01,
f_router02, and f_router03 as I think you intended based on following.
[color=blue]
log { source(s_remote); filter(f_router01); destination(d_router01); };
log { source(s_remote); filter(f_router02); destination(d_router02); };
log { source(s_remote); filter(f_router03); destination(d_router03); };
Now i have no logfiles! :mad: Its looks as if the filter option don’t
works![/color]
I suspect the filter option is working but it’s not matching the
hostname - try
filter f_router01 { netmask(10.0.0.1/32); };
filter f_router02 { netmask(10.0.0.2/32); };
filter f_router03 { netmask(10.0.0.3/32); };
instead.
HTH.
Simon
SUSE Knowledge Partner
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.