LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-01-2014, 12:49 PM   #1
WyattOil
LQ Newbie
 
Registered: Jun 2011
Distribution: Suse 11.4
Posts: 13

Rep: Reputation: 10
Question cron - Move logging from /var/log/messages


Goal: To have cron events logged to solely in /var/log/cron.log This will make my /var/log/messages file easier to audit since there will be less "noise" to sift through.

I have done the following (SUSE distro if that matters).
1) Edited /etc/rsyslog.conf to include:
# Cron logging
cron.* -/var/log/cron.log

2) touched and chmoded /var/log/cron.log to create the file and set permissions.

3) Restarted syslog so the new config file settings were read.

Cron events are logging to that file now, but they also are still being logged to /var/log/messages.

I need to know what additional changes I need to make in order to prevent cron events from logging to /var/log/messages.

Thank you in advance.
 
Old 02-01-2014, 06:18 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
Here's an example of how, on openSUSE 13.1, I direct log messages from the dhcpcd process only to a separate log file:

Code:
# dhcpcd messages in a separate file, and not in /var/log/messages.
if      ($programname == 'dhcpcd')  \
then    -/var/log/dhcp
&       stop



#
# the rest in one file
#
*.*;mail.none;news.none                 -/var/log/messages
The:
Code:
stop
says that the chosen log messages should not be matched against any further patterns in the configuration file, that processing of the selected messages should stop at that point. If the stop wasn't there, *.* would match, and the messages would also be placed in /var/log/messages. In fact, since I've included only part of the configuration file, there are also other patterns later in the file that would match.

HTH.
 
Old 02-01-2014, 07:21 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by WyattOil View Post
Cron events are logging to that file now, but they also are still being logged to /var/log/messages.
I need to know what additional changes I need to make in order to prevent cron events from logging to /var/log/messages.
What you simply need to do is post your syslog configuration. Because without that we don't know where things go wrong.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logging messages from my program doesn't reach /var/log/messages rajas Programming 4 09-18-2011 12:38 AM
Logging a to /var/log/messages using python heeman Linux - Newbie 1 03-25-2011 01:10 PM
segfaults are not logging into /var/log/messages ravikumarv Linux - General 1 12-10-2010 08:20 AM
/var/log/messages and /var/log/cron not working sigkill Linux - Software 6 08-09-2008 01:08 PM
Logging to /var/log/messages paddyjoy Programming 5 12-19-2005 06:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration