我正在建立一个单词列表,其中包含诸如错误、失败、杀死、警告、超出、结束、太.....ETC。
这样我就可以使用 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
所以,我的问题是,有没有针对这种坏词的词汇表?
抱歉,有错别字。
谢谢。
答案1
带有单词列表的外壳包装
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" $*
}
截屏