1822036 Members
3536 Online
109639 Solutions
New Discussion

Apache Logging to FIFO

 
Ralph Grothe
Honored Contributor

Apache Logging to FIFO

Hi,

of course I first read the comments for the logging relevant directives in httpd.conf itself.

Then I also referenced the Apache online docs at
http://httpd.apache.org/docs/logs.html

But it didn't reveal how to accomplish this.

I tried simply creating a FIFO with mkfifo (or mknod) in $SERVER_ROOT$/logs/agent_log
(I first wanted to test with additional logging of clients' user agents)


# ll /app/brevis/apache/logs/agent_log
prw-r--r-- 1 root sys 0 Jun 30 09:57 /app/brevis/apache/logs/agent_log


In httpd.conf I added these (or simply uncommented in the case of Logfile format description for agent_log)


# grep -E '^(CustomLog|Log).*agent' httpd.conf
LogFormat "%{User-agent}i" agent
CustomLog /app/brevis/apache/logs/agent_log agent

and sent SIGUSR1 to master httpd to gracefully restart it.

When I simply had a
tail -f /app/brevis/apache/logs/agent_log
nothing got read from the fifo

I also tried a slightly modified path to the fifo by prepending a pipe symbol, as on does for instance when referring to an external program such as logrotate.
But then I got an entry in error_log on httpd receiving SIGUSR1, that the path to fifo above couldn't be executed.

Would I need to refer to an external logger such as syslog-ng for having Apache writing logs to fifos, or can this be accomplished with a plain Apache config hack?

Rgds.
Ralph
Madness, thy name is system administration
1 REPLY 1
Bejoy C Alias
Respected Contributor

Re: Apache Logging to FIFO

Try removing the full path and add a relative path , in ur case try using CustomLog logs/agent_log agent . In my case after creating the log file using mkfifo , i was not even able to restart the apache server using SIGUSR1. It just hangs during startup . So i used a normal agent_log file ( no fifo ) to log the user agents and was able to get the desired results. Y do u use fifo file , is there any specific need ?
Be Always Joy ......