<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Aug 21, 2008 at 7:25 AM, Balazs Scheidler <span dir="ltr"><<a href="mailto:bazsi@balabit.hu">bazsi@balabit.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Wed, 2008-08-20 at 09:10 -0500, midnight codder wrote:<br>
> Thanks for all of those alternatives.<br>
> Allow me to rephrase my question (any idea): Does anyone have any idea<br>
> as to why I am getting the broken pipe?<br>
> The script I am using now is for the sake of simplifying things so I<br>
> can pin point where troubles begin.<br>
> We are not going to use such a script in production.<br>
> The original java program that was supposed to be the destination is<br>
> much more complicated, although in a sense it still reads the log<br>
> messages off of std in, just like the script. (it is the handling of<br>
> the logs afterwards that is complex).<br>
> I shall investigate into using one of the alternatives, however - I<br>
> will still be happy to know what might have went wrong.<br>
<br>
><br>
</div><div class="Ih2E3d">> <priC> <date 08-08-19T15:13:56.198-05:00> <host=oracle-test><br>
> <msg=syslog-ng[27971]: I/O error occurred while writing;<br>
> fd='11', error='Broken pipe (32)'><br>
> <priF> <date 08-08-19T15:13:56.198-05:00> <host=oracle-test><br>
> <msg=syslog-ng[27971]: Sending child a TERM signal;<br>
> child_pid='27972'><br>
<br>
</div>Your script terminates for some reason, it's not syslog-ng that kills<br>
your process, it is your script that dies.<br>
<br>
please run syslog-ng under strace -f (to follow forks) and see why your<br>
shell script exits.<br>
<font color="#888888"><br>
--<br>
Bazsi<br>
</font><div><div></div><div class="Wj3C7c"><br>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
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>
FAQ: <a href="http://www.campin.net/syslog-ng/faq.html" target="_blank">http://www.campin.net/syslog-ng/faq.html</a><br>
<br>
</div></div></blockquote></div><br>Balazs,<br>I can't seem to find the command line option that you've mentioned. there is -F (running int he foreground) and -f <config file name>.<br>I don't see any command line option that refers to following forks.<br>
I am running syslog-ng with -v and -d to get as many as messages as possible.<br><br>The good news, however, are that the script now is running successfully. (I had a typo, as usually, the mistake is so obvious it cannot be noticed)<br>
But my java program still fails to intercept any message. For any of you java driven syslog-ng users out there, please review this bit of code, perhaps you can point out where I went wrong. Here is the java code, it is a small main method:<br>
<br><br><div style="margin-left: 40px;"> <span style="background-color: rgb(204, 204, 204);">static public void main(String[] args) throws IOException {</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> int counter = 0;</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> Scanner scanner = new Scanner(System.in);</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> while (scanner.hasNextLine()) {</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> counter++;</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> String syslog = scanner.nextLine();</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> FileWriter writer =</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> new FileWriter(</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> new File(</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> System.getProperty("user.home") + "/" +</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> SyslogProgramDestination.class.getSimpleName() + "_" +</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> counter + ".log"));</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> try {</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> writer.write(syslog + "\n");</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> } catch (Exception e) {<br> e.printStackTrace();<br> } finally {</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> writer.close();</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> }</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);"> }</span><br style="background-color: rgb(204, 204, 204);">
<span style="background-color: rgb(204, 204, 204);"> }</span><br style="background-color: rgb(204, 204, 204);"><span style="background-color: rgb(204, 204, 204);">}</span></div></div>