Commit 05f7bb47 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add make_nginx_access_errors.sh

parent 0557904c
#!/bin/sh
NS=/var/local/nginx-stat/nginx-access-errors.txt
echo "All nginx access errors logs " > $NS
date >>$NS
TODAY=$(date "+%Y/%m/%d")
filter_today()
{
grep "^$TODAY"
}
TODAYA=$(date "+%d/%b/%Y")
filter_todaya()
{
grep "\[$TODAYA"
}
pe()
{
echo -n "$1: "
cat $0.tmp1 | grep " $1 " | wc -l
}
for i in /var/log/nginx/*access*.log ; do
[ -s "$i" ] || continue
cat "$i" | grep " 50[0234] " >$0.tmp1
tail $0.tmp1 -n100 | filter_today >$0.tmp
tail $0.tmp1 -n100 | filter_todaya >>$0.tmp
[ -s "$0.tmp" ] || continue
echo
echo "$i ($(pe 500) $(pe 501) $(pe 502) $(pe 503) $(pe 504))"
cat $0.tmp
done >>$NS
rm -f $0.tmp $0.tmp1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment