<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Martin</DIV>
<DIV>&nbsp;</DIV>
<DIV>Your solution to use perl script is working fine. Net::SNMP&nbsp; worked fine.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Many thanks for all the help.<BR><BR>--- On <B>Fri, 12/10/10, Martin Holste <I>&lt;mcholste@gmail.com&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From: Martin Holste &lt;mcholste@gmail.com&gt;<BR>Subject: Re: [syslog-ng] Convert syslog to traps<BR>To: difficult_id@yahoo.com<BR>Cc: "Syslog-ng users' and developers' mailing list" &lt;syslog-ng@lists.balabit.hu&gt;<BR>Date: Friday, December 10, 2010, 11:39 AM<BR><BR>
<DIV class=plainMail>Your config looks fine for syslog-ng as far as the destination is<BR>concerned.&nbsp; It's really that simple.<BR><BR>Depending on your load, go with what works, but a bash script will<BR>probably be a lot less efficient than a Perl script as the program.<BR>The Net::SNMP Perl module provides a way to send snmp traps.&nbsp; From the<BR>module man page:<BR><BR>($session, $error) = Net::SNMP-&gt;session(<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;[-hostname&nbsp; &nbsp; &nbsp; =&gt; $hostname,]<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;[-port&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&gt; $port,]<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;... lots more options possible ...<BR><BR>$result = $session-&gt;snmpv2_trap(<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [-delay&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;=&gt; $seconds,]&nbsp;&nbsp;&nbsp;# non-blocking<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -varbindlist&nbsp; &nbsp; &nbsp; =&gt; \@oid_value,<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;);<BR><BR>See Bazsi's earlier comment about picking what OID to use.<BR><BR>A small, properly written script should perform extremely well.&nbsp; I'd<BR>guess that on older hardware it would send 5-10k traps/sec without too<BR>much of an issue.<BR><BR>Again though, if what you've got works, no reason to change it yet.<BR><BR><BR><BR>On Fri, Dec 10, 2010 at 9:53 AM, Jay &lt;<A href="http://us.mc393.mail.yahoo.com/mc/compose?to=difficult_id@yahoo.com" ymailto="mailto:difficult_id@yahoo.com">difficult_id@yahoo.com</A>&gt; wrote:<BR>&gt;<BR>&gt; Many Thanks to all those who
 replied.<BR>&gt;<BR>&gt;<BR>&gt; Martin:<BR>&gt;<BR>&gt; It is version 2.0.3<BR>&gt;<BR>&gt; Thank you for the hint. Now have fixed the issue in my program and is working fine as expected. It doesn't send the new line chars any more. I am copy-pasting the config and program. Please let me know, if it can still be improved.<BR>&gt;<BR>&gt;<BR>&gt; syslog-ng.conf:<BR>&gt; destination convert_syslog_to_trap&nbsp; {<BR>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; program ("/tmp/convertSyslogToTrap");<BR>&gt; };<BR>&gt;<BR>&gt; cat /tmp/convertSyslogToTrap:<BR>&gt; #!/bin/bash<BR>&gt; &nbsp;read syslog<BR>&gt; &nbsp;# Process the syslog message and forward it as trap using&nbsp; /usr/local/bin/snmptrap<BR>&gt;<BR>&gt;<BR>&gt; Mathew:<BR>&gt;<BR>&gt; I do use Net-SNMP to an extent with embedded perl. But mostly I use it for receiving SNMP traps. Do you mean that, it provides a facility to receive syslogs as well ? If so, would be interested to
 use that feature. Are they any comparision chars available between Net-SNMP syslog receiving capability and syslog-ng capability ?<BR>&gt;<BR>&gt; Balazs&nbsp; &amp;&nbsp; Clayton<BR>&gt;<BR>&gt; This request is not specific to Cisco devices and requirement is to handle syslogs. Also, it is not possible to suggest to my customer to configure devices to send traps for syslogs.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; --- On Thu, 12/9/10, Martin Holste &lt;<A href="http://us.mc393.mail.yahoo.com/mc/compose?to=mcholste@gmail.com" ymailto="mailto:mcholste@gmail.com">mcholste@gmail.com</A>&gt; wrote:<BR>&gt;<BR>&gt; From: Martin Holste &lt;<A href="http://us.mc393.mail.yahoo.com/mc/compose?to=mcholste@gmail.com" ymailto="mailto:mcholste@gmail.com">mcholste@gmail.com</A>&gt;<BR>&gt; Subject: Re: [syslog-ng] Convert syslog to traps<BR>&gt; To: <A href="http://us.mc393.mail.yahoo.com/mc/compose?to=difficult_id@yahoo.com"
 ymailto="mailto:difficult_id@yahoo.com">difficult_id@yahoo.com</A>, "Syslog-ng users' and developers' mailing list" &lt;<A href="http://us.mc393.mail.yahoo.com/mc/compose?to=syslog-ng@lists.balabit.hu" ymailto="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</A>&gt;<BR>&gt; Date: Thursday, December 9, 2010, 2:05 PM<BR>&gt;<BR>&gt; I think program() is the best bet for you.&nbsp; I haven't had anything like that happen when using program().&nbsp; What version of syslog-ng are you using?&nbsp; I don't think syslog-ng is sending newlines, but your script may be interpreting "silence" from syslog-ng as nothing and appending a newline or something.&nbsp; If you post a snippet from your script showing how it's reading from syslog-ng, that would help.&nbsp; It would also help to see the config relevant to the program() destination.<BR>&gt;<BR>&gt; On Thu, Dec 9, 2010 at 12:27 PM, Jay &lt;<A
 href="http://us.mc393.mail.yahoo.com/mc/compose?to=difficult_id@yahoo.com" ymailto="mailto:difficult_id@yahoo.com">difficult_id@yahoo.com</A>&gt; wrote:<BR>&gt;<BR>&gt; Have a requirement to convert all incoming syslogs to SNMP traps and send it to another host. One option I could think of is to use program () destination.<BR>&gt;<BR>&gt; When I tried this option, I find that syslog-ng is continuously sending newline characters to the specified program. i.e. even when no syslog is received, syslog-ng seems to be pumping newline chars to the specified program.<BR>&gt;<BR>&gt; Also I read the warning message in admin guide that, it will open up the door to DOS attack.<BR>&gt;<BR>&gt; Could someone let me know the best way to achieve this, please ?<BR>&gt;<BR>&gt; Thanks in advance for the help.<BR>&gt; John<BR>&gt;<BR>&gt; ______________________________________________________________________________<BR>&gt; Member info: <A
 href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target=_blank>https://lists.balabit.hu/mailman/listinfo/syslog-ng</A><BR>&gt; Documentation: <A href="http://www.balabit.com/support/documentation/?product=syslog-ng" target=_blank>http://www.balabit.com/support/documentation/?product=syslog-ng</A><BR>&gt; FAQ: <A href="http://www.campin.net/syslog-ng/faq.html" target=_blank>http://www.campin.net/syslog-ng/faq.html</A><BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt;<BR></DIV></BLOCKQUOTE></td></tr></table><br>