You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Milind Vaidya <ka...@gmail.com> on 2017/03/22 21:30:47 UTC

[users@httpd] external log reader not getting restarted every hour

I have following setting in my *httpd.conf*

*ErrorL**og* *"| /usr/bin/tee -a /var/log/httpd/error_log |  java program
reading msgs from stdinput"*

The error_log file gets rotated using logrotate every hour.

The java program has following statement

*while** ((msg = **this**.stdinReader.readLine()) != **null**) {*

*}*

This essentially reads the lines till EOF is encountered.  After this I
close all the resources and the main method ends.

Earlier I was NOT ending the program when EOF was encountered. So apache
used to start new process every hour keeping old one intact. But this
stopped happening when the logic to terminate program was added when EOF is
encountered.


But now this does not seem to work with everything else remaining same. Now
the same process keeps on running for days together which is little
worrisome as does not look like the normal behaviour.


What are my debugging options here.

Re: [users@httpd] external log reader not getting restarted every hour

Posted by Milind Vaidya <ka...@gmail.com>.
Thanks for reply.


Earlier we had the model you described above.


tail -n0 -F /var/log/httpd/error_log /var/log/httpd/ssl_error_log | java
program


We experienced that there is some message loss, meaning java program was
not able to get few logs very irregularly. Though the number was very less
we needed to fix it. So we reduced one hop by getting rid if the tail.

And as I said, it was working with the setting mentioned in original
question. It used to spin off new program after terminating previous one.
But it suddenly stopped doing that.

On Thu, Mar 23, 2017 at 5:44 AM, Houser, Rick <ri...@jackson.com>
wrote:

> Stick with rotatelogs and adjust your program (or provide a separate
> helper) to read the logs from disk as a traditional log parser?  That way,
> you have standard logging behavior, your customizations aren’t altering
> httpd behavior, and you could even drop your utility onto an existing
> Apache server with no config changes.
>
>
>
>
>
> Rick Houser
>
> Web Administration
>
>
>
> *From:* Milind Vaidya [mailto:kavadsa@gmail.com]
> *Sent:* Wednesday, March 22, 2017 17:31
> *To:* users@httpd.apache.org
> *Subject:* [users@httpd] external log reader not getting restarted every
> hour
>
>
>
>
>
> I have following setting in my *httpd.conf*
>
> *ErrorL**og* *"| /usr/bin/tee -a /var/log/httpd/error_log |  java program
> reading msgs from stdinput"*
>
> The error_log file gets rotated using logrotate every hour.
>
> The java program has following statement
>
> *while** ((msg = **this**.stdinReader.readLine()) != **null**) {*
>
> *}*
>
> This essentially reads the lines till EOF is encountered.  After this I
> close all the resources and the main method ends.
>
> Earlier I was NOT ending the program when EOF was encountered. So apache
> used to start new process every hour keeping old one intact. But this
> stopped happening when the logic to terminate program was added when EOF is
> encountered.
>
>
>
> But now this does not seem to work with everything else remaining same.
> Now the same process keeps on running for days together which is little
> worrisome as does not look like the normal behaviour.
>
>
>
> What are my debugging options here.
>

RE: [users@httpd] external log reader not getting restarted every hour

Posted by "Houser, Rick" <ri...@jackson.com>.
Stick with rotatelogs and adjust your program (or provide a separate helper) to read the logs from disk as a traditional log parser?  That way, you have standard logging behavior, your customizations aren’t altering httpd behavior, and you could even drop your utility onto an existing Apache server with no config changes.


Rick Houser
Web Administration

From: Milind Vaidya [mailto:kavadsa@gmail.com]
Sent: Wednesday, March 22, 2017 17:31
To: users@httpd.apache.org
Subject: [users@httpd] external log reader not getting restarted every hour


I have following setting in my httpd.conf

ErrorLog "| /usr/bin/tee -a /var/log/httpd/error_log |  java program reading msgs from stdinput"

The error_log file gets rotated using logrotate every hour.

The java program has following statement

while ((msg = this.stdinReader.readLine()) != null) {

}

This essentially reads the lines till EOF is encountered.  After this I close all the resources and the main method ends.

Earlier I was NOT ending the program when EOF was encountered. So apache used to start new process every hour keeping old one intact. But this stopped happening when the logic to terminate program was added when EOF is encountered.



But now this does not seem to work with everything else remaining same. Now the same process keeps on running for days together which is little worrisome as does not look like the normal behaviour.



What are my debugging options here.