Logs

使用 grep 和 wordlist 搜尋失敗的日誌?

  • May 22, 2020

我正在建構一個單詞表,其中將包含諸如錯誤、失敗、殺死、警告、超出、過度等單詞……等。

這樣我就可以使用 grep 在幾秒鐘內過濾大量日誌以查找問題。

特別是,它用於探勘 linux 日誌。

找到1: https ://github.com/cornet/ccze

static char *words_bad[] = {
 "warn", "restart", "exit", "stop", "end", "shutting", "down", "close",
 "unreach", "can't", "cannot", "skip", "deny", "disable", "ignored",
 "miss", "oops", "not", "backdoor", "blocking", "ignoring",
 "unable", "readonly", "offline", "terminate", "empty", "virus"
};

static char *words_error[] = {
 "error", "crit", "invalid", "fail", "false", "alarm", "fatal"
};

找到 2: https ://raygun.com/platform/crash-reporting

所以,我的問題是,對於這種不好的詞,是否已經存在任何詞表?

對不起,錯別字。

謝謝你。

帶有 wordlist 的 Shell 包裝器

grepbad() {
 grep --color=always -i "warn\|restart\|exit\|stop\|end\|shutting\|down\|close\|\
unreach\|can't\|cannot\|skip\|deny\|disable\|ignored\|\
miss\|oops\|not\|backdoor\|blocking\|ignoring\|\
unable\|readonly\|offline\|terminate\|empty\|virus" $*
}

grepgood() {
 grep --color=always "activ\|start\|ready\|online\|load\|ok\|register\|detected\|\
configured\|enable\|listen\|open\|complete\|attempt\|done\|\
check\|listen\|connect\|finish\|clean" $*
}

greperror() {
 grep --color=always -i 'error\|crit\|invalid\|fail\|false\|alarm\|fatal\|over\|too\|out of\|kill\|exception\|ban\|not' $*
}

grepsystem() {
 grep --color=always "ext2-fs\|reiserfs\|vfs\|iso\|isofs\|cslip\|ppp\|bsd\|\
linux\|tcp/ip\|mtrr\|pci\|isa\|scsi\|ide\|atapi\|\
bios\|cpu\|fpu\|discharging\|resume" $*
}

截屏

dmesg

引用自:https://unix.stackexchange.com/questions/588255