> -----Original Message----- > From: [email protected] [mailto:rsyslog- > [email protected]] On Behalf Of Lukasz Szybalski > Sent: Thursday, November 12, 2009 4:00 PM > To: rsyslog-users > Subject: Re: [rsyslog] multiprocess/multithread web app to rsyslog > > On Thu, Nov 12, 2009 at 8:23 AM, Rainer Gerhards > <[email protected]> wrote: > > If "myapp" is the tag, you can use this: > > > > :syslogtag, contains, "maypp" /home/lucas/20091112.txt > > > > There are better comparisons than "contains", but I don't know them > out of my > > head. They are in the filter doc. > > > > Getting closer. > I put a file in /etc/rsyslog.d/myapp.conf > > Inside I have: > :syslogtag, contains, "myapp" /home/lucas/20091112.txt > > the rsyslog creates the file but no messages are logged in, they only > appear in /var/log/messages > > Nov 12 08:45:32 localhost 2009-11-12 08:45:32,452 - myapp - INFO -
aha! this message is not really well-formed, please also see http://www.rsyslog.com/doc-syslog_parsing.html So the tag here is "2009-11-12". You can either use a custom parser, or if that would be sufficent, check msg instead of syslogtag. Rainer > This is a message > > > Ideas why its not logging it in? > > Also, > Can I make this config file like this? It doesn't seem to work...? > :syslogtag, contains, "myapp" /home/lucas/$year$month$day.txt > > > http://www.rsyslog.com/doc-property_replacer.html > > Thanks, > Lucas > > > > > > HTH > > Rainer > > > >> -----Original Message----- > >> From: [email protected] [mailto:rsyslog- > >> [email protected]] On Behalf Of Lukasz Szybalski > >> Sent: Thursday, November 12, 2009 3:19 PM > >> To: [email protected] > >> Subject: Re: [rsyslog] multiprocess/multithread web app to rsyslog > >> > >> Anybody know what the filter or a config line would be that would > >> filter my "myapp" messages to a file in /home/lucas/20091112.txt? > >> > >> Ideas? > >> Thanks, > >> Lucas > >> > >> > >> On Tue, Nov 10, 2009 at 7:02 PM, Lukasz Szybalski > <[email protected]> > >> wrote: > >> > Hello, > >> > I have a web application deployed in multiprocess and multi-thread > >> > scenario. ( 3 processes and 10 threads each). > >> > > >> > I want to log search query string from users to a file called > >> > todaysdate.log ...20091109.log > >> > > >> > > >> > I'm using a python app but I can't get rsyslog in debian system to > >> > catch and write my messages. Would you know how can I set this up? > >> > > >> > > >> > Here is a sample test case....in python. > >> > Save below to a file and run it. > >> > python testfile.py > >> > > >> > > >> > #----testfile.py----- > >> > from logging.handlers import SysLogHandler > >> > > >> > import logging > >> > > >> > > >> > # create logger > >> > logger = logging.getLogger("myapp") > >> > logger.setLevel(logging.DEBUG) > >> > ch = SysLogHandler('/dev/log') > >> > ch.setLevel(logging.DEBUG) > >> > # create formatter > >> > formatter = logging.Formatter("%(asctime)s - %(name)s- > %(levelname)s - > >> > %(message)s") > >> > # add formatter to ch > >> > ch.setFormatter(formatter) > >> > logger.addHandler(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 > >> > > >> > Thanks, > >> > Lucas > >> > > >> > >> > _______________________________________________ > rsyslog mailing list > http://lists.adiscon.net/mailman/listinfo/rsyslog > http://www.rsyslog.com _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com

