Hello,
the "man syslog.conf" explains how to filter syslog messages by facility (auth, authpriv, cron, daemon, kern, ... ) or by priority (debug, info, notice, warning, ...).
But how could I redirect messages by a program name, like "drupal" or "php"? For example I have in /var/log/messages:
Mar 20 04:20:44 mysite drupal: http://mysite%7C1300594844%7Cpage not found|66.249.66.193|http://mysite/sites/default/files/pictures/picture-7133-1300462418.png%7C%7C...
Mar 20 04:20:50 mysite drupal: http://www.mysite%7C1300594850%7Cpage not found|93.158.148.31|http://www.mysite/viewtopic.php?f=5&t=42639&p=165661&sid=7394443...
but I would like them to go under /var/log/drupal
(and I'll rotate them later by adding a file to /etc/logrotate.d ....)
Regards Alex
On 20.3.2011 14:55, Alexander Farber wrote:
the "man syslog.conf" explains how to filter syslog messages by facility (auth, authpriv, cron, daemon, kern, ... ) or by priority (debug, info, notice, warning, ...).
But how could I redirect messages by a program name, like "drupal" or "php"? For example I have in /var/log/messages:
Classic syslog can not do this. But there are alternative syslogs available. syslog-ng can filter by program name. I am not sure about rsyslog.
rsyslog can do this as well and has a great filtering feature that is available. rsyslog will (should) be the default logging daemon in CentOS 6 (as it is for RHEL6).
From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Markus Falb Sent: Sunday, March 20, 2011 10:00 AM To: centos@centos.org Subject: Re: [CentOS] syslog.conf - how to redirect messages by a program name?
On 20.3.2011 14:55, Alexander Farber wrote:
the "man syslog.conf" explains how to filter syslog messages by facility (auth, authpriv, cron, daemon, kern, ... ) or by priority (debug, info, notice, warning, ...).
But how could I redirect messages by a program name, like "drupal" or "php"? For example I have in /var/log/messages:
Classic syslog can not do this. But there are alternative syslogs available. syslog-ng can filter by program name. I am not sure about rsyslog.
-- Best Regards, Markus Falb
________________________________
No virus found in this message. Checked by AVG - www.avg.comhttp://www.avg.com Version: 10.0.1204 / Virus Database: 1498/3518 - Release Date: 03/20/11
On Sun, Mar 20, 2011 at 10:18 AM, Damian Tommasino DTommasino@tradecard.com wrote:
rsyslog can do this as well and has a great filtering feature that is available. rsyslog will (should) be the default logging daemon in CentOS 6 (as it is for RHEL6).
And if you've got a tweaked, older syslog.conf, you can usually just install it as rsyslog.conf and it will work the way it used to.
Thank you for your replies.
I've ended up doing the following for my PHP and Drupal logs:
Uncommented error_log = /var/log/php/php_errors.log in /etc/php.ini # mkdir /var/log/php # chown -R apache.apache /var/log/php
Appended following line to /etc/syslog.conf local6.* /var/log/php/drupal.log
In Drupal modules screen enabled Syslog module and diabled Database Logging module
In Drupal settings screen changed Syslog to LOCAL6
(And later I'll add rotation scripts under /etc/logrotate.d )
Regards Alex
--On Sunday, March 20, 2011 11:58 AM -0400 Nico Kadel-Garcia nkadel@gmail.com wrote:
And if you've got a tweaked, older syslog.conf, you can usually just install it as rsyslog.conf and it will work the way it used to.
I just switched on my C5.5 system and it was almost completely painless. Append syslog.conf to rsyslog.conf, stop and disable syslog ("service stop syslog" "chkconfig syslog off"), then start and enable rsyslog (both can be installed together).
Redirect program output with a rule like this, placed above your copied syslog.conf directives:
:programname, startswith, "drupal" -/var/log/drupal &~
Remember to add additional log files to /etc/logrotate.d/syslog.
centos-bounces@centos.org wrote:
Hello,
the "man syslog.conf" explains how to filter syslog messages
But how could I redirect messages by a program name, like "drupal" or "php"? I would like them to go under /var/log/drupal
This 1-liner script needs fired off at system boot. tail --follow=name --retry /var/log/messages | grep drupal: > /var/log/drupal
The grep patters might be expanded -E "(drupal|php)"
Insert spiffy .sig here: Life is complex: it has both real and imaginary parts.
//me ******************************************************************* This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. www.Hubbell.com - Hubbell Incorporated**