loader image

【Mod_security⑨】ルールごとの発生回数をカウントしファイル出力

mkdir -p /usr/local/mod_security_summary/statistic/ruleid/`date +%Y%m%d`
find /usr/local/mod_security_summary/`date +%Y%m%d`/ -type f | xargs grep REQUEST_HEADERS:Host | grep Message: | cut -d "]" -f 4,6,9,10 | tr -d "\"[iddatamaturityaccuracy" | sed s/]/,/g | sed 's/\(.*\)  \(.*\)  \(.*\)  \(.*\)/\2,\1,\3,\4/g' |  tr -d " " | sed s/,,/,/g > /usr/local/mod_security_summary/statistic/ruleid/`date +%Y%m%d`/No9
cat /usr/local/mod_security_summary/statistic/ruleid/`date +%Y%m%d`/No9 | while read line;do severity=$line; echo -n "$severity"",";grep $severity /usr/local/mod_security_summary/statistic/ruleid/`date +%Y%m%d`/No9 | wc -l ; done | sort | uniq | sed "s/^/`date +%Y%m%d`,/g" | sed  '1s/^/date,host,rule_id,maturity,accuracy,count\n/'

コメント

タイトルとURLをコピーしました