my problem is the following:
My pythons script receives data via sys.stdin, but it needs to wait until new data is available on sys.stdin.
As described in th
This works for me, code of /tmp/alog.py:
#! /usr/bin/python
import sys
fout = open("/tmp/alog.log", "a")
while True:
dat = sys.stdin.readline()
fout.write(dat)
fout.flush()
in http.conf:
CustomLog "|/tmp/alog.py" combined
The key is don't use
for dat in sys.stdin:
You will wait there get nothing. And for testing, remember fout.flush(), otherwise you may not see output. I test on fedora 15, python 2.7.1, Apache 2.2, not cpu load, alog.py will exists in memory, if you ps you can see it.