[Resolved] Issues with pipedLogger

Status
Not open for further replies.

toki

Active Member
#1
Hi,

I have pipedLogger configured for my access logs as attached.

However, when I tail -f the fifo, and hit the webserver with curl, nothing is logged.

I change this to NOT be a pipedLogger, and logs are written:

[root@eureka litespeed]# tail -f lsws-access.fifo
- 172.16.46.1 - - [24/Nov/2015:16:43:25 +1100] "GET /foo HTTP/1.1" 404 1148 "-" "curl/7.43.0"
- 172.16.46.1 - - [24/Nov/2015:16:43:26 +1100] "GET /foo HTTP/1.1" 404 1148 "-" "curl/7.43.0"
- 172.16.46.1 - - [24/Nov/2015:16:43:26 +1100] "GET /foo HTTP/1.1" 404 1148 "-" "curl/7.43.0"
- 172.16.46.1 - - [24/Nov/2015:16:43:26 +1100] "GET /foo HTTP/1.1" 404 1148 "-" "curl/7.43.0"

Any ideas on how to make this work would be appreciated.

Cheers,
Toki
 

Attachments

toki

Active Member
#2
Actually I may be reading this all wrong. Is logging to a fifo even supported?

Do I need to write an external pipedLogger application that accepts input on its STDIN and then writes that out to the fifo?

I have tried to implement this with a simple shell script:

#!/bin/bash
CAT="/bin/cat"
ACCESS_LOG_FIFO="/var/log/litespeed/lsws-access.fifo"
${CAT} >> ${ACCESS_LOG_FIFO}
exit 0

And then configure as per screenshot. But it still isn't working (when I set the piped logger for access log to be my piped logger external application).

The script itself works fine:

[lsadm@eureka /]$ echo "foo" | /usr/local/bin/piped_logger.sh
[lsadm@eureka /]$

[root@eureka ~]# tail -f /var/log/litespeed/lsws-access.fifo
foo

[root@eureka ~]# ls -l /var/log/litespeed/lsws-access.fifo
prw-r--r-- 1 lsadm lsadm 0 Nov 24 17:31 /var/log/litespeed/lsws-access.fifo

Please advise. Thanks!
 

Attachments

Last edited:

toki

Active Member
#4
Thanks - but this is what I'm trying - I have a simple access logger configured like this:

Code:
    <accessLog>
      <fileName>/var/log/litespeed/lsws-access.log</fileName>
      <logFormat>%v %h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;</logFormat>
      <rollingSize>1M</rollingSize>
      <keepDays>1</keepDays>
      <compressArchive>0</compressArchive>
    </accessLog>
If /var/log/litespeed/lsws-access.log is a plain file, it logs fine. If it is a FIFO, nothing is logged. I want to log to a FIFO. So I thought about setting up the external piped logger. I create a simple shell script:

Code:
#!/bin/bash
CAT="/bin/cat"
ACCESS_LOG_FIFO="/var/log/litespeed/lsws-access.fifo"
${CAT} >> ${ACCESS_LOG_FIFO}
exit 0
Then I create the piped logger with details as shown in the attached screenshot. I then go to the log configuration in the LSWS Web interface and select piped-logger from the drop down. Nothing is logged to the FIFO when I tail it. If I just try:

# echo "test" | /usr/local/bin/piped_logger.sh

and in another terminal I do

# tail -f /var/log/litespeed/lsws-access.fifo

I see the string "test". It works fine. But I can't get LiteSpeed to log to this FIFO.

Please assist. This is part of an important upgrade project from an early LiteSpeed version, and with the volume of logs that we have, we need the FIFO (so we can configure syslog-ng to read from the FIFO and forward on to our remote log server).

Just FYI when I set up the piped logger, my configuration is:

Code:
    <accessLog>
      <fileName>$SERVER_ROOT/logs/access.log</fileName>
      <pipedLogger>piped_logger</pipedLogger>
      <rollingSize>10M</rollingSize>
      <keepDays>30</keepDays>
      <compressArchive>0</compressArchive>
    </accessLog>
and
Code:
  <extProcessor>
  <type>logger</type>
  <name>piped_logger</name>
  <maxConns>1</maxConns>
  <path>/usr/local/bin/piped_logger.sh</path>
  </extProcessor>
Even if I just try writing to a file with my piped logger, it isn't working.

I can see in an strace that my piped_logger.sh external application *is* being accessed:

[root@eureka tmp]# grep piped strace.out
82832 access("/usr/local/bin/piped_logger.sh", X_OK) = 0

Thanks
 

Attachments

Last edited:

NiteWave

Administrator
#5
all the settings you've posted are correct to me -- I've followed the steps and completed the test successfully.

now please check various permission issue:
#ls -al /usr/local/bin/piped_logger.sh
the script may be run by user "nobody", to ensure nobody user has permission to run it
also, check permission of /var/log/litespeed/lsws-access.fifo, to ensure /var/log/litespeed/ already created, etc.
 

toki

Active Member
#6
Thanks for the reply.

I've checked permissions on the script, looks okay to me:

[root@eureka conf]# ls -al /usr/local/bin/piped_logger.sh
-rwxr-xr-x 1 root staff 121 Nov 24 17:23 /usr/local/bin/piped_logger.sh

[root@eureka conf]# ls -ld /var/log/litespeed
drwxr-xr-x 2 lsadm lsadm 4096 Nov 25 13:14 /var/log/litespeed

I've even chmod 666 the fifo for testing:

[root@eureka litespeed]# ls -l /var/log/litespeed/lsws-access.fifo
prw-rw-rw- 1 lsadm lsadm 0 Nov 25 13:17 /var/log/litespeed/lsws-access.fifo

Everything looks good to me :/
 

toki

Active Member
#8
Even with a fresh install, no access logging is occurring:

Code:
[root@eureka lsws-5.0.7]# cd /usr/local/lsws/logs
[root@eureka logs]# ls -arlt
total 16
drwxr-sr-x 15 root  root  4096 Nov 25 13:36 ..
-rw-r--r--  1 root  root    65 Nov 25 13:36 lsrestart.log
-rw-r--r--  1 lsadm lsadm    0 Nov 25 13:36 stderr.log
-rw-r--r--  1 lsadm lsadm    0 Nov 25 13:36 access.log
drwxr-sr-x  2 root  root  4096 Nov 25 13:36 .
-rw-r--r--  1 lsadm lsadm 2334 Nov 25 13:36 error.log
[root@eureka logs]# tail -f access.log
I hit the server repeatedly with
# curl -H 'Host: localhost' localhost

I get nothing in the log file?
 

toki

Active Member
#9
On a fresh install on my VPS, nothing is written to the access logs either. These are all Debian Jessie. Might try a different OS.

Code:
root@nancyboy:/usr/local/lsws/logs# ls -alrt
total 16
drwxr-sr-x 15 root  root  4096 Nov 25 02:50 ..
-rw-r--r--  1 root  root    52 Nov 25 02:50 lsrestart.log
-rw-r--r--  1 lsadm lsadm    0 Nov 25 02:50 stderr.log
-rw-r--r--  1 lsadm lsadm    0 Nov 25 02:50 access.log
drwxr-sr-x  2 root  root  4096 Nov 25 02:50 .
-rw-r--r--  1 lsadm lsadm 2139 Nov 25 02:50 error.log
OK - tried on CentOS too. No access logging out-of-the-box on version 5.0.8 and 5.0.8-ent. Please advise.
 
Last edited:
#12
Note: each virtual host has its own access.log, if a access don't belong to any virtual host, then go to sever level access.log.

toki has configured piped log for server level access.log but see nothing --- since all access has gone to virtual host access.log but not configured piped log at those virtual hosts.

toki's final solution:
1. for each virtual host's access log, set "Log Control" to "Server's Log File"
2. at server level access log, set to "Piped Logger". so needn't configure each virtual host's access log as "Piped log"
 
Status
Not open for further replies.
Top