I would like to create a script which culls statistics about logins, su
attempts, connects, etc. from the log files contained in the
syslog.dated/<dated directory> I recycle my system daily after backup to
cleanup defunct processes, so a new <dated directory> is created every day.
How can I extract the exact name and plug it into a script so that I can cd
to it, and run greps and wc commands, etc on the log files? For example, I
would have to ls the /var/adm/syslog.dated directory, and extract as a
string the directory name 17-Sep-03:12 then cd
/var/adm/syslog.dated/17-Sep-03:12
Does anyone have code or a monitoring scripts you'd be willing to share?
Thanks.
Carole Thompson
California Lutheran University
carole_at_callutheran.edu
# pwd
/usr/var/adm/syslog.dated
# ls -ls
total 8
1 drwxr-xr-x 2 root adm 512 Sep 12 04:28 12-Sep-04:28
1 drwxr-xr-x 2 root adm 512 Sep 13 04:28 13-Sep-04:28
1 drwxr-xr-x 2 root adm 512 Sep 14 04:29 14-Sep-04:29
1 drwxr-xr-x 2 root adm 512 Sep 15 03:11 15-Sep-03:11
1 drwxr-xr-x 2 root adm 512 Sep 16 03:11 16-Sep-03:11
1 drwxr-xr-x 2 root adm 512 Sep 17 03:12 17-Sep-03:12
# cd 17-Sep-03:12
# ls
auth.log kern.log mail.log user.log
daemon.log lpr.log syslog.log
Received on Tue Sep 17 1996 - 20:44:14 NZST