<br><div class="gmail_quote">On Thu, Jul 3, 2008 at 7:37 PM, Adam Hewitt <<a href="mailto:ahewitt@theozhewitts.com">ahewitt@theozhewitts.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ryan King wrote:<div><div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
On Thu, Jul 3, 2008 at 6:44 PM, Adam Hewitt <<a href="mailto:ahewitt@theozhewitts.com" target="_blank">ahewitt@theozhewitts.com</a> <mailto:<a href="mailto:ahewitt@theozhewitts.com" target="_blank">ahewitt@theozhewitts.com</a>>> wrote:<br>
<br>
Hi All,<br>
<br>
I am trying to get snmptraps passed through to syslog-ng and then<br>
sent through an interpretor into Nagios. I have snmptrapd logging<br>
to syslog, and I have added the following lines to syslog-ng.conf:<br>
<br>
destination d_nagios { file("/tmp/test_file.txt"); };<br>
filter f_snmptrap { program("snmptrapd"); };<br>
log { source(s_sys); filter(f_snmptrap); destination(d_nagios); };<br>
<br>
sending it to the test_file was just to make sure I was actually<br>
catching the snmptrapd logs which I am not.<br>
<br>
I have tried a number of variations on the ("snmptrapd") such as<br>
("snmptrapd\[.*\]") and none of them work.<br>
<br>
can anyone see where my logic has gone astray?<br>
<br>
cheers,<br>
<br>
Adam.<br>
<br>
<br>
<br>
Hey Adam,<br>
<br>
It's been a while, how's it going ;)<br>
<br>
Can't see anything obviously wrong - but I am wondering about 'snmptrapd' and if it's actually logging to the source you are using? Depending on the version of snmptrapd / dist, you have to specify -Ls for it to use syslog... But what does source s_sys look like?<br>
<br>
What about just removing the filter and dumping source s_sys straight to that temp file - just to make sure the messages are coming through that source and to double check the program name?<br>
<br>
That's where I'd start anyway.<br>
<br>
Ryan<br>
<br>
</blockquote>
<br></div></div>
Gday Ryan,<br>
<br>
The s_sys looks like this:<br>
<br>
source s_sys {<br>
unix-stream("/dev/log");<br>
udp();<br>
tcp(ip(<a href="http://0.0.0.0" target="_blank">0.0.0.0</a>) port(5000) max-connections(300));<br>
internal();<br>
};<br>
<br>
I do have -L in the snmptrapd command and it is definitely logging to syslog. If I comment out all the other log lines in the syslog-ng.conf file I get nothing being logged including the snmptrapd entries, which means that it is just my entry that is not matching correctly. I also changed the filter to program(.*) and that seemed to pick it all up as well, so it is definitely something with my filter.<br>
<br>
(sorry I should have been more specific with my previous email, but I was typing it with a screaming baby bouncing on my lap :/ )<br>
<br>
Cheers again.<div><div></div><div class="Wj3C7c"><br>
</div></div></blockquote><div><br>Maybe snmptrapd is logging with a different program name (caps? missing?) or just doing something weird. For another test (to see if snmptrapd is behaving), try changing the facility it logs to. ie: "snmptrapd -Ls local1" and change:<br>
<br>filter f_snmptrap { program("snmptrapd"); };<br><br>to<br><br>filter f_snmptrap { facility(local1); };<br></div></div><br><br>Can you paste an example line from your log that shows a snmptrapd message?<br><br>
Ryan<br><br><br>