![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 9 | 12-01-2008 11:37 PM |
| Date parsing into string, help! | martyb555 | Shell Programming and Scripting | 5 | 02-17-2008 10:12 PM |
| need to create a file with its name having system date | hamsa | Shell Programming and Scripting | 11 | 10-18-2006 05:48 AM |
| Command DATE in UNIX System | ZINGARO | UNIX for Dummies Questions & Answers | 3 | 07-20-2006 06:07 PM |
| file date vs. system date | ober5861 | UNIX for Dummies Questions & Answers | 8 | 09-11-2001 03:36 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
parsing a system log file via the 'date' command
Hello,
I'm trying to update some scripts here that parse our system logs daily. They report information just fine... but they just report too much info. Specifically, if there's been some failed login attempts on several different days (say Monday and Tuesday), when I get the report from Wendsday, I don't want to see Wednesday's info *in addition* to Monday & Tuesday (and so on throughout the week). This is happening because of this syntax that I've found isn't working: grep -i fail $LOGDIR/$LOG2 |grep `date |awk '{print $2}' ` | grep `date |awk '{print $3}' This is giving me information for every day in my logfile... not just on the day the script is running - which is what I prefer. It seems like if I could make use of this aspect of the date command I'd be ok: % date '+%C' Wed May 9 08:23:20 EDT 2007 since the 'May 9' (May, with two spaces and then the 9) is exactly how the syntax of the month/day shows up: May 9 08:27:10 mysystem sshd2[15562]: [ID 702911 auth.error] auths-pam: PAM subprocess returned packet SSH_PAM_OP_ERROR. (err_num: 9, err_msg: Authentication failed) May 9 08:27:10 mysystem sshd2[15562]: [ID 702911 auth.notice] Password authentication for user cjones failed (from xxx.xxx.xxx.xxx port 53341). So... my thinking is that if I could find the right use of the 'date' command then I could use that with a grep to pull out *exactly* what I want out of my logfiles. But it's also possible there's a different way to get the same results. I'd prefer to do this in a sh/csh script also. Thanks in advance! -chris |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|