[Chicago] multiprocess/multithread web app to rsyslog

Lukasz Szybalski szybalski at gmail.com
Thu Nov 12 15:31:28 CET 2009


Would anybody know how to configure rsyslog so that I can send
messages to it from my python app?

I have a web application that is deployed in multi-thread and process
environment and I need to log information to a file (not db). One
solution is to create your own logging deamon (twisted) that listens
and saves your info or use the existing one like rsyslog in debian.

scenario: ( 3 processes and 10 threads each).

I want to log search query string from users to a file  called
todaysdate.log ...20091109.log

Here is a sample python file...I have another one that uses
multiprocess to simulate mulithread writing to a file.

#-----test.py ----
from logging.handlers import SysLogHandler
import logging
# create logger
logger = logging.getLogger("myapp")
ch = SysLogHandler('/dev/log')
# create formatter
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s
- %(message)s")
# add formatter to ch
logger.info('This is a message')

How can I setup rsyslog to filter "myapp" and save the messages to a
file in /home/lucas/myapp/20091109.txt

Have you used something else to log data into a file from
multi-process/thread program? (no DB do, just file)


More information about the Chicago mailing list