SysAdmin Mag: Checking Your System Logs with awk
Aug 18, 2001, 19:00 (12 Talkback[s])
(Other stories by Jose Nazario)
[ Thanks to Andrew for
this link. ]
"UNIX systems are especially talkative and log
considerable amounts of data. Many administrators at first find
digging through all those logs annoying, and some abandon the
practice of checking logs for that reason. However, when system
problems arise, those admins are left wondering what occurred and
why. Because there is so much data to sift through on a regular
UNIX system, efficiency must be sought to make sense of all of this
data and keep a watchful eye on your system.
My tool of choice to solve this matter is the awk language.
Originally, I used grep in a rather wieldy shell script, and didn't
want to port it to Perl. I found that awk provided a bit more
flexibility than my sometimes convoluted shell script, worked very
well for the ordered structure of log files, and had better regular
expression handling than grep. I will show several notification
items that can be readily picked out, and put them together in an
awk script to parse log files in a pretty quick manner.
While most administrators are familiar with grep, most have not
become so familiar with awk, instead favoring Perl. awk has a
number of advantages over grep, and even a few over Perl."
Complete
Story
Related Stories:
- UnixReview.com: Effective awk Programming [Book Review](Aug 12, 2001)
- LinuxProgramming: Gawk 3.1.0 released(Jun 12, 2001)
- IBM developerWorks: Awk by example, Part 3(Apr 07, 2001)
- IBM developerWorks: Awk by example, Part 2 - Records, loops, and arrays(Jan 14, 2001)
- IBM developerWorks: Awk by example, Part 1 - An intro to the great language with the strange name(Jan 14, 2001)
- Linuxtopia: Awk Learn-to(Nov 08, 1999)
- LinuxFocus: Examples with awk: A short introduction(Sep 19, 1999)
- Linux Journal: Book Review -- UNIX awk and sed Programmer's Interactive Workbook(May 31, 1999)