01-09-2008
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 exists that will do this for me? If not I was thinking this could be a nice tool to use 'awk,' but I am not the best at 'awk.' I'm just a hack.
My current filter* only sends me logs when I have errors but it gives me the full set of data at that time, and I have to search for Fail. I copy my file to a tmp and clean up when done. Then I have my rotation set just rigt so I do not spam myself with dup data. PS I have read man for the cron/crontab commands + others and have not seen anything like this yet.
tia Keith
*
cronfile="/var/adm/cron/log"
tmp="/tmp/cron.tmp.log"
# COPY CRON FILE LOG TO TEMP TO SEND IN EMAIL LATER
cp -p $cronfile $tmp
#FILTER
if [[ $(cat $tmp | grep Fail | wc -l) > "1" ]] then
subject=$(print "Daily cron log $(date)" | tr ' ' '-')
uuencode $tmp $tmp | mail -s $subject $USER < $tmp
#end filter
fi
sleep 5;[[ -e $tmp ]] && rm $tmp
Last edited by Keith Johnson; 01-10-2008 at 11:37 AM..
This User Gave Thanks to Keith Johnson For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
Here im using WinSCP and looking into the remote dir var/adm/cron and I get the following error.Is this bcoz i dont have admin privileges:
Cannot get real path for '/var/adm/cron'.
Unexpected OK response.
Error code: 0
Error message from server: Success
Request code: 16
BTW im... (1 Reply)
Discussion started by: thumsup9
1 Replies
2. AIX
I am trying to get the /etc/cronlog.conf working, but so far have not been able to.
I created the /etc/cronlog.conf file with the following entries.
logfile=/var/adm/cron/log
size=30k
rotate=2
compress
Then I kill the current cron daemon and check to make sure that it has respawned with... (4 Replies)
Discussion started by: chosie
4 Replies
3. Red Hat
I'm running RedHat Linux Enterprise Server ES Version 3 and I've stopped the audit service. Now I'm getting the following error messages in /var/log/cron
May 17 07:01:01 pam crond: LAuS error - do_command.c:243 - laus_log: (19) laus_log: No such device
May 17 08:01:01 pam crond: (root) CMD... (1 Reply)
Discussion started by: soliberus
1 Replies
4. Solaris
I want to know if there is any documentation or any type of information that can give a list of all of the return codes that can be seen in the /var/cron/log. I have seen a couple in my log file. Example: rc=1 and rc=64. (2 Replies)
Discussion started by: sjames
2 Replies
5. Solaris
I recently enabled sar (system activity recorder tool) on a Solaris 10 sparc
system.
The performance "logs" being recorded in /var/adm/sa
are getting quite large, quite quickly! How do I rotate these logs so I keep 7 days worth of logs and everything else gets automatically deleted? I... (1 Reply)
Discussion started by: RobSand
1 Replies
6. Solaris
hi sirs
can u tell the difference between /var/log/syslogs and /var/adm/messages
in my working place i am having two servers.
in one servers messages file is empty and syslog file is going on increasing..
and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies
7. Solaris
Hi,
Is the contents in /var/log/syslog and /var/adm/messages are same??
Regards (3 Replies)
Discussion started by: vks47
3 Replies
8. Solaris
I have noticed this error in /var/cron/log:
> CMD: /usr/lib/acct/ckpacct
> adm 6739 c Tue Oct 11 10:00:00 2011
< adm 6739 c Tue Oct 11 10:00:00 2011 rc=1
! bad user (adm) Tue Oct 11 11:00:00 2011but when I try to list crontab of user 'adm':
solarni/~# crontab -l adm
crontab: you are... (4 Replies)
Discussion started by: orange47
4 Replies
9. Solaris
Hi all,
I have enable sar and the sa cron jobs in the sys account.
I would like to however, keep only 1 month of data.
Can i check for Solaris10, does sa2 do automatic purging of logs in /var/adm/sa/ that are 1 week old ?
-- Answer = yes ( in "/usr/lib/sa/sa2" if you open the script,... (2 Replies)
Discussion started by: javanoob
2 Replies
10. Shell Programming and Scripting
I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog.
tail -f /var/log/messages
dblogger: msg_to_dbrow: no logtype using missing
dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies
CRON(8) System Manager's Manual CRON(8)
NAME
cron - daemon to execute scheduled commands (Vixie Cron)
SYNOPSIS
cron
DESCRIPTION
Cron should be started from /etc/rc or /etc/rc.local. It will return immediately, so you don't need to start it with '&'.
Cron searches /var/spool/cron for crontab files which are named after accounts in /etc/passwd; crontabs found are loaded into memory. Cron
also searches for /etc/crontab and the files in the /etc/cron.d/ directory, which are in a different format (see crontab(5)). Cron then
wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When execut-
ing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if
such exists).
Additionally, cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed, and if it has,
cron will then examine the modtime on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab
file is modified. Note that the Crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.
SEE ALSO
crontab(1), crontab(5)
AUTHOR
Paul Vixie <paul@vix.com>
4th Berkeley Distribution 20 December 1993 CRON(8)