IIS log analyzer for Linux
Christos Cheretakis
xalkina at otenet.gr
Tue Nov 2 22:23:06 EET 1999
Christos Cheretakis wrote:
>
> Eixa gracei prin kana-dyo mhnes kati skriptakia gia na metatrepoyn to
> daily format se xlf, alla den uymamai an ta exv krathsei. Ua cajv kai ua
> soy pv...
>
> C.
Ti scriptaki poy soy yposxeuhka! Prin to trejeis metafereis s' ena
directory ta *.log poy apouhkeyei se tessera o IIS. Ena spasmeno sed poy
yparxei einai gia na sbhsei apo to telos ths grammhs ena CR, an de
doyleyei gia kapoio logo, peiraje to me to xeri.
C.
--
Oi filoi moy oloi edv kai xronia
Zeygaria ginan, ftiajan spitia
Monaxa emena xaskei akoma
Xvris mia stegh etoyth h alhueia...
-------------- next part --------------
#! /bin/bash
all="*.log"
for i in $all; do
files="$files ${i%.log}"
done
all=$files
files=""
for i in $all; do
files="$files ${i#??}"
done
files="`echo $files | tr ' ' '\012' | sort | uniq`"
for i in $files; do
day=${i#????}
month=${i%??}; month=${month#??};
case "$month" in
01) month="Jan";;
02) month="Feb";;
03) month="Mar";;
04) month="Apr";;
05) month="May";;
06) month="Jun";;
07) month="Jul";;
08) month="Aug";;
09) month="Sep";;
10) month="Oct";;
11) month="Nov";;
12) month="Dec";;
esac
year="19${i%????}"
cat *${i}.log |
sort |
sed "s/
$//" |
grep -v '^#' |
awk '
{
printf("%s ", $2);
printf("- ");
printf("%s ", $3);
printf("['$day/$month/$year':%s +0200] ", $1);
printf("\"%s %s%s\" ", $4, $5, (($6 != "-") ? (sprintf("?%s", $6)) : ""));
printf("%s ", $7);
printf("%s ", $8);
printf("\"%s\" ", $(11) );
printf("\"%s\"", $9);
printf("\n");
}
'
done
More information about the Linux-greek-users
mailing list