Setting up rsyslog filter

I am writing something and I wanted to take advantage of Linux API for logging, I wanted to put the logs of my app to different files, so I added those lines to rsyslog.conf

if $programname == 'RearWindowDaemon' then /var/log/RearWindowDaemon.log 
if $programname == 'RearWindow' then /var/log/RearWindow.log

but something is not working, even with this simple code:

int main()
{
openlog("RearWindow",0,LOG_LOCAL0);
syslog(LOG_ERR,"some err");
syslog(LOG_ERR,"other err");
return;
}

I get the logs to /var/log/syslog and not to /var/log/RearWindow.

Should I do anything more? I am using XUbuntu 11.10 if it matters.

Answers


Probably it's late a bit. But what I can understand, you should compile your code such that it produces the binary with name 'RearWindow'. $programname checks if logs are coming from a process with the specified name not that the log contains the string 'RearWindow'. Hopefully this helps.


Need Your Help

Open source Java library to produce webpage thumbnails server-side

java open-source thumbnails

I am searching for an open source Java library to generate thumbnails for a given URL. I need to bundle this capability, rather than call out to external services, such as Amazon or websnapr.

Factual API vs Google Places API in terms of Distance Matrix (distance and time)

ios google-maps geolocation factual

I need enough accuracy in my app but Google Places seems to be poorly accurate filtering by category. So I'm considering migrating to Factual API. Do you guys have used it? What do you think about ...