How to change the log level for cron?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to change the log level for cron?
# 1  
Old 02-05-2010
How to change the log level for cron?

Hello,

I'm wondering how to change the log level to level 2 for cron without manually have to restart it with every boot.

I didn't thing this would be hard to find, but searching has cause me to come up empty.

System is Ubuntu Karmic/9.10

With thanks,
Narnie[COLOR="#738fbf"]
# 2  
Old 02-06-2010
Amend /etc/rsyslog.d/*.conf cron entry and then run:
Code:
kill -HUP $(cat /var/run/rsyslogd.pid)

instead?
See Man Page for rsyslogd (Linux Section 8) - The UNIX and Linux Forums
# 3  
Old 02-07-2010
Ok, what a great tip.

I found out about the change from syslog to rsyslog just a bit ago, but hadn't had a chance to see how to change the setting. I'll work on that, but your response also helped in that I didn't know those pid's were in /var/run. Nice 2 know.

Thanks,
Narnie

---------- Post updated 02-07-10 at 04:13 PM ---------- Previous update was 02-06-10 at 08:34 PM ----------

Well, after looking at it, I don't see that cron is started here nor it's log level set.

How does one change the log level using /etc/rsyslog.d/50-default.conf? It seems pretty much to be a file for letting rsyslog know WHERE to log it, not so much as HOW to log it (as in which log level)

Here is the file:

Code:
#  Default rules for rsyslog.
#
#            For more information see rsyslog.conf(5) and /etc/rsyslog.conf

#
# First some standard log files.  Log by facility.
#
auth,authpriv.*            /var/log/auth.log
*.*;auth,authpriv.none        -/var/log/syslog
#cron.*                /var/log/cron.log
daemon.*            -/var/log/daemon.log
kern.*                -/var/log/kern.log
lpr.*                -/var/log/lpr.log
mail.*                -/var/log/mail.log
user.*                -/var/log/user.log

#
# Logging for the mail system.  Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info            -/var/log/mail.info
mail.warn            -/var/log/mail.warn
mail.err            /var/log/mail.err

#
# Logging for INN news system.
#
news.crit            /var/log/news/news.crit
news.err            /var/log/news/news.err
news.notice            -/var/log/news/news.notice

#
# Some "catch-all" log files.
#
*.=debug;\
    auth,authpriv.none;\
    news.none;mail.none    -/var/log/debug
*.=info;*.=notice;*.=warn;\
    auth,authpriv.none;\
    cron,daemon.none;\
    mail,news.none        -/var/log/messages

#
# Emergencies are sent to everybody logged in.
#
*.emerg                *

#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
#    news.=crit;news.=err;news.=notice;\
#    *.=debug;*.=info;\
#    *.=notice;*.=warn    /dev/tty8

# The named pipe /dev/xconsole is for the `xconsole' utility.  To use it,
# you must invoke `xconsole' with the `-file' option:
# 
#    $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
#      busy site..
#
daemon.*;mail.*;\
    news.err;\
    *.=debug;*.=info;\
    *.=notice;*.=warn    |/dev/xconsole

This also doesn't show how the initial cron daemon is started to begin with. I'll bet the log level is started there with the -L argument.

With thanks,
Narnie
# 4  
Old 02-07-2010
Change the line:
Code:
#cron.*                /var/log/cron.log

Removing the # would make it do maximum logging.
Code:
cron.err                /var/log/cron.log

Will log errors, critical, alert and emergency/panic types messages only.

https://www.unix.com/man-page/Linux/5/rsyslog.conf/ lists the different logging levels.

Last edited by TonyFullerMalv; 02-07-2010 at 06:31 PM..
# 5  
Old 02-07-2010
Ah, IC.

Thanks!

I assume if I wanted the logs to keep going to syslog.log I'dd just change it to /var/log/syslog.log rather than have it's own logfile?

With thanks,
Narnie

---------- Post updated at 04:58 PM ---------- Previous update was at 04:51 PM ----------

Quote:
Originally Posted by TonyFullerMalv
Change the line:
Code:
#cron.*                /var/log/cron.log

Removing the # would make it do maximum logging.
Code:
cron.err                /var/log/cron.log

Will log errors, critical, alert and emergency/panic types messages only.

Man Page for rsyslog.conf (Linux Section 5) - The UNIX and Linux Forums lists the different logging levels.
I'm beginning to get the picture, but I looked at the above link and it doesn't describe the various log possibilities. You mention .err, but how do I learn about other options?

on the cron(8) man page, it states that:

Code:
SYNOPSIS
       cron [-f] [-l] [-L loglevel]
. . .
-L loglevel
               Sets the loglevel for cron. The standard logging level  (1)  will
               log  the  start  of all the cron jobs. A higher loglevel (2) will
               cause cron to log also the end of all cronjobs, which can be use‐
               ful  to audit the behaviour of tasks run by cron. Logging will be
               disabled if the loglevel is set to zero (0).

This makes it seem that it is numerically based.

This has me confused.

Thanks,
Narnie
# 6  
Old 02-07-2010
In the Selectors section of the manpage it says:
Quote:
The priority is one of the following keywords, in ascending
order: debug, info, notice, warning, warn (same as warning),
err, error (same as err), crit, alert, emerg, panic (same as
emerg). The keywords error, warn and panic are deprecated and
should not be used anymore. The priority defines the severity of
the message.
I would not change the log file location for cron, you confuse the hell out of any other system admin. who needs to look at your machine, likwise there may already be scripts in place looking at /var/log/cron.
# 7  
Old 02-07-2010
Thank you for your patients and help.

What if I wanted to turn off ALL logging of crons? Even tho it seems in my config cron is set not to log by being commented out, it IS logging.

What is happening is that I'm getting a huge backlog of cron mail processes because they get hung in trying to mail log reports to the running user as per this thread:

https://www.unix.com/unix-dummies-que...processes.html

I was hoping that turning off cron jobs might be a test to see if that will solve that problem. The only other problem is that I really would like log level 2 where it will send a mail when the cron job starts and then stops. First, I just want to stop the accumulation of cron jobs.

Thanks,
Narnie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Change run level at boot

for solaris 11, how does one change the run level at boot from 3 to 2? i checked "/etc/inittab" file where i usually change it in other *nix but it seems solaris is not using it. (1 Reply)
Discussion started by: badbanana
1 Replies

2. Red Hat

SSL certificate generation on OS level or application level

We have a RHEL 5.8 server at the production level and we have a Java application on this server. I know of the SSL certificate generation at the OS (RHEL) level but it is implemented on the Java application by our development team using the Java keytool. My doubt is that is the SSL generation can... (3 Replies)
Discussion started by: RHCE
3 Replies

3. UNIX and Linux Applications

how to change isolation level to READ COMMITTED

Hi, I am using perl DBI and mysql-5.0.26 on unix. Could you please let me know or point to source on how to set isolation level to READ COMMITTED . ~Thanks (2 Replies)
Discussion started by: newbielgn
2 Replies

4. Red Hat

RHCS debug log level

Hi everyone, Can you help me on how to set up the debug level of RHCS? I need more information on the cluster.log so that i can futher troubleshoot our problem being encontered now. Thanks.:) (1 Reply)
Discussion started by: shtobias
1 Replies

5. Solaris

Difference between run level & init level

what are the major Difference Between run level & init level (2 Replies)
Discussion started by: rajaramrnb
2 Replies

6. UNIX for Dummies Questions & Answers

Copying files to a different server without Permission level change..

Hi, I was trying to copy/transfer some new and old files from one server to another server. I found the permission of the files are different in both servers. I tried to tar all the files and then send to the other server, and then also the permission level is different after copying the files.... (4 Replies)
Discussion started by: ronix007
4 Replies

7. Shell Programming and Scripting

runing script with log level 4

i have bash script with some batches, and when i putt log level 4 in script i get error while executing or if i rung script.sh with parameter log level 4. i appriciate some advice :) (3 Replies)
Discussion started by: unknown1
3 Replies

8. AIX

AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log

Hi, I can use 'crontabs –e' and do all the scheduling I like. However I would like to auto send myself just the cronjobs logs that fail. That is to say the PIDs that fail and the related lines with those PID’s only. (Not the full set of logs) Has anyone done this work? Or does an AIX 5.3 tool... (0 Replies)
Discussion started by: Keith Johnson
0 Replies

9. UNIX for Advanced & Expert Users

process nice level command line vs cron

Under, Solaris 10 I have the following problem: A script executed at command line runs with nice level 0, as expected. Same script started under (user) crontab runs with nice level 2. I would prefer it run at 0. Is this possible? If so, how? Thanks. (0 Replies)
Discussion started by: henrydark
0 Replies
Login or Register to Ask a Question