…elogs greppen

eigentlich nur für mich selbst, damit ich es nicht jedes mal neu suchen muss:

in den elogs (/fnsw/local/logs/elogs/elogYYYYMMDD) sind kritische fehler mit “[SERIOUS]” zu erkennen – danach zu greppen ist also ohne probleme möglich. allerdings steht die wichtige information erst in der zeile danach:

2007/12/31 09:26:37.532 121,0,41 INXbg -s IndexServer (4513) … [SERIOUS]
Oracle not available. (ORA-3113), (File: ../src/GDBO.c, Line 3823)

daher reicht ein normales grep nicht – aber awk kann helfen:

export R=SERIOUS
awk ‘{if ($0~/’$R’/) {print $0; n=1} else { if (n==1) {print $0; n=0}}}’ elogYYYYMMDD

2 thoughts on “…elogs greppen

  1. leider nein…

    ~/local/logs/elogs> cat /etc/release
    Solaris 9 9/04 s9s_u7wos_09 SPARC
    Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
    Use is subject to license terms.
    Assembled 29 June 2004

    grep: illegal option — C
    Usage: grep -hblcnsviw pattern file . . .

Comments are closed.