1

I'm trying to write Apache 2.4 errors to an error log and sending them to a Graylog2 server using a Python script. Looking at examples such as http://www.fnal.gov/docs/products/apache/syslog_logs_notes.html and http://zindilis.com/docs/apache-logs-to-remote-syslog.html. The examples show I should use tee, for example:

ErrorLog "| tee -a /var/log/httpd/error_log | nc -u -j syslog.example.com 514"

I'm doing the following:

ErrorLog "| /usr/bin/tee -a /var/log/httpd/domains/test.error.log | /usr/bin/python /opt/apache2gelf/test.py"

The messages are written to the logs but the python script is not executed. The Python script has 755 permissions. What am I missing here?

user2511309
  • 309
  • 3
  • 18

1 Answers1

0

Try:

ErrorLog "| /usr/bin/tee -a /var/log/httpd/domains/test.error.log | xargs /opt/apache2gelf/test.py"

And make sure that the first line of your script is a proper interpreter, e.g #!/usr/bin/env python

M. Adel
  • 401
  • 5
  • 7