Differences

This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:config:piped-logger [2015/07/30 18:45] (current)
Michael Alegre created
Line 1: Line 1:
 +====== How To Use A Piped Logger For Flexible Logging ======
  
 +A piped logger is a standalone application that receives access log data sent by web server through a pipe on its STDIN stream. This makes flexible logging possible, like logging into a database or logging to remote server. ​
 +
 +===== A piped logger example =====
 +Here is a simple piped logger written in Perl, which receives logging data from STDIN and append data received to a file on local harddisk:
 +
 +  #​!/​usr/​bin/​perl
 +  open LOG, '>>​ ../​logs/​pipedaccess.log';​
 +  select LOG;
 +  $| = 1;
 +  while (<>)
 +  {
 +     print LOG $_;
 +  }
 +
 +To use a piped logger, first, you need to define an external application with type "Piped Logger",​ then go to "​Access Log" configuration and select the "Piped logger"​ from the drop down list. Once a piped logger is set, access log data will be sending to the logger application instead of the access log file.
 +
 +===== Logging through syslog =====
 +You can configure LSWS to use syslog, logging access to syslog.
 +
 +First, add the following line to your /​etc/​syslog.conf file:
 +
 +  local0.info /​var/​log/​lsws_access_log
 +
 +Then create a logger application with path like this:
 +
 +  /​usr/​bin/​logger -p local0.info ​
 +
 +syslogd is pretty slow, it may not be the best solution for a busy server
 +
 +===== Logging to remote server through syslog =====
 +To log to remote server via syslog, you only need to change the syslog configuration in above example to:
 +
 +  local0.info ​ @ip_or_hostname_of_remote_server
 +
 +===== Using syslog-ng =====
 +
 +[[http://​www.balabit.com/​products/​syslog_ng/​|syslog_ng]] is a good replacement for syslogd.
 +Here is toturial on [[http://​www.serverwatch.com/​tutorials/​article.php/​3600641|Building a Secure Logging Server With syslog-ng]]
  • Admin
  • Last modified: 2015/07/30 18:45
  • by Michael Alegre