Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running CentOS 5.3 and would like to log all messages from the "at" daemon. My syslog.conf contains the following entry:

cron.* /var/log/cron

I assumed that cron line in syslog refers to the entire family of "cron, anacron, at and batch". However, while cron and anacron actions seem to get looged, "at" actions do not get logged. How do I log atd actions?

Thank you for your attention

(Added) I would like to add the contents of my syslog.conf just in case there is an error:

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* 						/dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none    	/var/log/messages

# The authpriv file has restricted access.
authpriv.*  					/var/log/secure

# Log all the mail messages in one place.
mail.*  						-/var/log/maillog


# Log cron stuff
cron.*  						/var/log/cron

# Everybody gets emergency messages
*.emerg 						*

# Save news errors of level crit and higher in a special file.
uucp,news.crit  					/var/log/spooler

# Save boot messages also to boot.log
local7.*    					/var/log/boot.log
share|improve this question
add comment

4 Answers 4

up vote 2 down vote accepted

From looking at the source of the 'at' program (from the CentOS 5.3 source repository) , it looks like it is indeed logging to syslog, but only fatal errors regarding the at daemon itself are logged (for example, if you try to run 2 at daemons at the same time).

However, process executions, resulting return code and standard error/output are not logged to syslog at all. Even when turning on debug (which requires recompilation) the log messages are not very informative (for end users) and write something like :

atd[24116]: pid 24121 exited with status 0.

Which will not help you a lot in identifying which command was ran, by which user or what was its standard output/error.

atd does send an email notification to the user who requested the command, in case the command had failed, or produced anything in it's standard output/error. But for commands that succeed without any output , no mail is sent. You can change that using the -m flag.

From at(1):

-m Send mail to the user when the job has completed even if there was no output.

share|improve this answer
add comment

/var/log/secure(RHEL)

atd logs via PAM, check your syslog.conf to find out where pam is logging to.

share|improve this answer
add comment

According to atd(8), it already logs to syslog, you just need to make sure that you don't have any bad syslog rules.

Maybe post your syslog.conf file here first.

Also note that atd is not configurable as far as designating a specific log facility, but that should not be a problem, you'll just have to make sure you're syslog configuration is right.

share|improve this answer
    
Here it is: I wish I could format it better that I have been able to. Thanks for the help .info;mail.none;authpriv.none;cron.none /var/log/messages authpriv. /var/log/secure mail.* -/var/log/maillog cron.* /var/log/cron .emerg * uucp,news.crit /var/log/spooler local7. /var/log/boot.log –  Ya. Perelman Jun 4 '09 at 9:56
    
Hi Gurunandan - Not a problem - but it's hard to read here, and impossible to format - instead - just update your original question. I see some weirdness in your paste, but it's hard to tell if it's because of the formatting or not. –  Xerxes Jun 4 '09 at 14:51
    
Pasted above. Thanks. –  Ya. Perelman Jun 4 '09 at 17:38
add comment

For cases like this I'll use a wrapper around the command that logs to syslog. For example:

#!/bin/bash
logger -i -t mycmd Starting
/bin/somecommand
logger -i -t mycmd Completed
exit 0

Then from cron, at, etc I'll call the wrapper script instead.

I know this is more of a work around than a solution, but it gets the job done.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.