Apache serverio log failo analizė programa
5 (100%) 1 vote

Apache serverio log failo analizė programa

#!/bin/sh

DIALOG=${DIALOG=dialog}

declare bytes_in_gb=1048576

declare procentai=100

laikinas=TMP

laikinas2=TMP2

declare -a lines

declare -a bytesamount



processLine(){

line=“$@“

}

if [ „$1“ == „“ ]; then

$DIALOG –title „DUOMENU NUSKAITYMAS“

–inputbox „Iveskite log failo pavadinima:“ 18 45 2> /tmp/inputbox.tmp.$$

retval=$?

input=`cat /tmp/inputbox.tmp.$$`

rm -f /tmp/inputbox.tmp.$$

case $retval in

0)

echo „Input string is ‘$input'“;;

1)

echo „Cancel pressed.“;;

255)

echo „Box closed.“;;

esac

inputfile=“$input“if [ ! -f $inputfile ]; then

$DIALOG –title „ERRROR“

–msgbox „$inputfile : neegzistuoja“ > „/dev/stderr“ 10 40

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac

exit 1

elif [ ! -r $inputfile ]; then

$DIALOG –title „ERRROR“

–msgbox „$inputfile: neimanoma nuskaityti“ > „/dev/stderr“ 10 40

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac

exit 2

fielif [ „$1“ == „–help“ ]; then

$DIALOG –title „HELP“

–msgbox „Programos paleidimas:n

sh n.shn

sh n.sh logn

n

n

n

n

… created By Nerijus Kliauba “ 15 50

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac

exit

else

inputfile=$1

if [ ! -f $inputfile ]; then

$DIALOG –title „ERRROR“

–msgbox „$inputfile : neegzistuoja“ > „/dev/stderr“ 10 40

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac

exit 1

elif [ ! -r $inputfile ]; then

$DIALOG –title „ERRROR“

–msgbox „$inputfile: neimanoma nuskaityti“ > „/dev/stderr“ 10 40

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac

exit 2

fi

fi

#————————————————————————–

d=0

until [ $d = 1 ];

do

$DIALOG –clear –radiolist „MENIU“ 15 90 8

„1“ „Narsykliu statistika“ off

„2“ „OS daznumas procentais “ off

„3“ „Operacines sistemos“ off

„4“ „Kiek duomenu persiunte serveris“ off

„5“ „Kokius metodus naudojo kiekvienas IP“ off

„6“ „Kiekvieno lankytojo persiustas kiekis duomenu“ off

„7“ „Suvestine“ off

„8“ „Iseiti“ off 2>/tmp/tmp.$$

input=`cat /tmp/tmp.$$`case $input in

#—————————————————————————————————-

1)

rezultfile=“IE“

rezultfile2=“IEPROC“

echo „“>$rezultfile

echo „“>$rezultfile2

echo „“>$laikinas zcat $inputfile | grep „Mozilla/4.0“ | grep „(compatible;“ |grep „MSIE“ | cut -f14,15 -d “ “ | sort | uniq -c | sort -g -r>>$laikinas

zcat $inputfile | grep „Mozilla/5.0“ | grep „Firefox“ | cut -f21 -d “ „| sort | uniq -c | sort -g -r>>$laikinas

zcat $inputfile | grep „Opera“| grep „Mozilla“| cut -f20,21,21,22 -d “ “ | sort | uniq -c | sort -g -r>>$laikinas

zcat $inputfile | grep „Opera“| cut -f12 -d “ „| sort | uniq -c | sort -g -r >>$laikinas

zcat $inputfile | grep „Mozilla/5.0“ | grep „Firefox“ | cut -f20 -d “ “ | sort | uniq -c | sort -g -r>>$laikinas

zcat $inputfile | grep „Mozilla/5.0“ | grep „Firefox“ | cut -f19 -d “ “ | sort | uniq -c | sort -g -r>>$laikinas all=0

all=$(zcat $inputfile | wc -l)

let all=all-2

echo „Viso: $all prisijungimai“>>$rezultfile

echo >>$rezultfile cat $laikinas |grep „MSIE“ |grep “ 2 (compatible; MSIE“ -v | cut -f1 -d “ “ >>$rezultfile2

cat $laikinas |grep „Firefox“ | cut -f1 -d “ “ >>$rezultfile2

cat $laikinas |grep „Opera“ | cut -f1 -d “ “ >>$rezultfile2

echo “ $(zcat $inputfile | grep „Opera“ -v | grep „Firefox“ -v | grep „MSIE“ -v| wc -l) Other“ >>$rezultfile2

echo „Narsykliu statistika: “ >>$rezultfile

echo „————————–“ >>$rezultfile

cat $rezultfile2 |sed ‘/“/s///g’>> $rezultfile echo „“>$rezultfile2

echo „Viso: $all prisijungimai“>>$rezultfile2

echo >>$rezultfile2

echo „Narsykle | Daznumas procentais “ >>$rezultfile2

echo „—————————————–“ >>$rezultfile2

echo -n “ MSIE | „>>$rezultfile2

echo „$(($(zcat $inputfile | grep „MSIE“ | wc -l)*100))/$all“ |bc -l >>$rezultfile2

echo -n “ OPERA | „>>$rezultfile2

echo „$(($(zcat $inputfile | grep „Opera“ | wc -l)*100))/$all“ |bc -l >>$rezultfile2

echo -n “ FIREFOX | „>>$rezultfile2

echo „$(($(zcat $inputfile | grep „Firefox“ | wc -l)*100))/$all“ |bc -l >>$rezultfile2

echo -n “ Other | „>>$rezultfile2

echo „$(($(zcat $inputfile | grep „MSIE“ -v | grep „Opera“ -v | grep „Firefox“ -v | wc -l)*100))/$all“ |bc -l >>$rezultfile2

echo -n „—————————————–“ >>$rezultfile2 rm $laikinas

$DIALOG –title „RESULTS:“

–msgbox „nRezultatus rasite failuose: n$rezultfilen$rezultfile2“ 10 50

case $? in

0)

echo „OK“;;

255)

echo „Box closed.“;;

esac;;

#———————————————————————————————–

2)

rezultfile=“OSPROC“

echo „“>$rezultfile

all=0

all=$(zcat $inputfile | wc -l)

let all=all-2

echo „Viso: $all prisijungimai“>>$rezultfile

echo >>$rezultfile

echo „Operacine sistema | Daznumas procentais “ >>$rezultfile

echo „—————————————–“
>>$rezultfile

echo -n “ Windows | „>>$rezultfile

echo „$(($(zcat $inputfile | grep „Windows“ | wc -l)*100))/$all“ |bc -l >>$rezultfile

echo -n “ Linux | „>>$rezultfile

echo „$(($(zcat $inputfile | grep „Linux“ | wc -l)*100))/$all“ |bc -l >>$rezultfile

echo -n “ Mac OS | „>>$rezultfile

echo „$(($(zcat $inputfile | grep „Mac OS“ | wc -l)*100))/$all“ |bc -l >>$rezultfile

echo -n “ FreeBSD | „>>$rezultfile

Šiuo metu Jūs matote 50% šio straipsnio.
Matomi 690 žodžiai iš 1376 žodžių.
Peržiūrėkite iki 100 straipsnių per 24 val. Pasirinkite apmokėjimo būdą:
El. bankininkyste - 1,45 Eur.
Įveskite savo el. paštą (juo išsiųsime atrakinimo kodą) ir spauskite Tęsti.
SMS žinute - 2,90 Eur.
Siųskite sms numeriu 1337 su tekstu INFO MEDIA ir įveskite gautą atrakinimo kodą.
Turite atrakinimo kodą?
Po mokėjimo iškart gausite atrakinimo kodą, kurį įveskite į laukelį žemiau:
Kodas suteikia galimybę atrakinti iki 100 straispnių svetainėje ir galioja 24 val.