Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

Re: lug-bg: sum and sort with bash


  • Subject: Re: lug-bg: sum and sort with bash
  • From: Ivailo Ivanov <higeronimo@xxxxxxxxx>
  • Date: Thu, 21 Oct 2004 07:14:47 -0700 (PDT)

--- Georgi Genov <ggenov@xxxxxxxxxxx> wrote:

> Ivailo Ivanov wrote:
> 
> >                  Zdraveite,
> >Imam fail sas sledata struktura:
> >
> >source-ip-1 dest-ip bytes digit1 digit2 digit3
> >source-ip-2 dest-ip bytes digit1 digit2 digit3
> >source-ip-1 dest-ip bytes digit1 digit2 digit3
> >source-ip-1 dest-ip bytes digit1 digit2 digit3
> >-----------------------
> >source-ip-n dest-ip bytes digit1 digit2 digit3
> >
> >Iskam da sortiram source ip-ta ta spriamo sumarnite
> >bytes ot vsiako ot tiah. Triabva da se polu4i
> neshto
> >takova, primerno:
> >
> >1. source-ip-1 10929Mb
> >2. source-ip-6 1234Mb
> >3. sourceip-24 125Mb
> >--------------------
> >I taka natatak....
> >
> >
> > 
> >
>
>============================================================================
> >  
> >
> Ð?а пÑ?едположим, Ñ?е:
> 
> source-ip-1 dest-ip bytes digit1 digit2 digit3
> source-ip-2 dest-ip bytes digit1 digit2 digit3
> source-ip-1 dest-ip bytes digit1 digit2 digit3
> source-ip-1 dest-ip bytes digit1 digit2 digit3
> 
> е нÑ?какÑ?в лог Ñ?айл Ñ? име
> trafic.log
> 
> Ð? да пÑ?едположим, Ñ?е знаеÑ?
> вÑ?иÑ?ко source-ip-*.
> 
> #!/bin/sh
> source_ip_db="10.0.1.2 10.0.1.3 10.0.1.4 10.0.1.5
> 10.0.1.6"
> for $source_ip in $source_ip_db; do
> tmp_trafic_ip=`cat trafic.log | grep "$source_ip " |
> tr -s ' ' | awk '{ 
> print $3 }'`
> trafic_db[$source_ip]=$(echo
> "${trafic_db[$source_ip]} + $tmp_trafic_ip" 
> | bc)
> echo "$source_ip ${trafic_db[$source_ip]}"
> done
> exit 0
> 
> Ð?е обеÑ?авам Ñ?ова да Ñ?абоÑ?и
> вÑ?е пак го пиÑ?аÑ? на
> пÑ?имавиÑ?Ñ?а.
> 
> Този Ñ?кÑ?ипÑ? би Ñ?Ñ?Ñ?бвало да
> Ñ?абоÑ?и Ñ?оÑ?но Ñ?ака какÑ?о Ñ?и
> поиÑ?ка, но не 
> виждам Ñ?миÑ?Ñ?л оÑ? Ñ?ова,
> заÑ?оÑ?о:
> Ð?ко Ñ?Ñ?ойноÑ?Ñ?Ñ?а на bytes е
> нÑ?каква моменÑ?на Ñ?Ñ?ойноÑ?Ñ?
> коÑ?Ñ?о Ñ?е пÑ?оменÑ? в 
> Ñ?еално вÑ?еме не би било
> логиÑ?ноÑ?
> да Ñ? Ñ?Ñ?миÑ?аÑ? Ñ?ама Ñ?Ñ?Ñ? Ñ?ебе
> Ñ?и.
> Ð?ко пÑ?к Ñ?ова е Ñ?екÑ?Ñ?а
> Ñ?Ñ?ойноÑ?Ñ? Ñ?о нÑ?ма логика да Ñ?
> Ñ?Ñ?миÑ?аÑ? Ñ? какеоÑ?о и 
> да е било.
> Ð? ако е нÑ?кй бÑ?оÑ?Ñ? каÑ?о на
> iptables, койÑ?о Ñ?ано или кÑ?Ñ?но Ñ?е
> нÑ?лиÑ?а би 
> било логиÑ?но да Ñ?Ñ?авнÑ?ваÑ?
> новаÑ?а Ñ?Ñ?оиноÑ?Ñ? Ñ? пÑ?Ñ?мо
> Ñ?Ñ?аÑ?аÑ?,
> и ако новаÑ?а е по-голÑ?ма
> знаÑ?и Ñ?Ñ? е акÑ?Ñ?алнаÑ?а и
> Ñ?Ñ?ава Ñ?Ñ?аÑ?а. Ð? ако 
> новаÑ?а е по малка знаÑ?и
> бÑ?оÑ?Ñ?а Ñ?е е нÑ?лиÑ?ал и Ñ?ледва
> да
> пÑ?ибавиÑ? новаÑ?а Ñ?Ñ?ойноÑ?Ñ?
> кÑ?м Ñ?Ñ?аÑ?аÑ?а, Ñ?езÑ?лÑ?аÑ?а е
> акÑ?Ñ?ална Ñ?Ñ?ойноÑ?Ñ? и Ñ?е 
> запиÑ?ва каÑ?о Ñ?Ñ?аÑ?а.
> 
> Ð?ко Ñ?ова коеÑ?о Ñ?Ñ?м Ñ?и
> напиÑ?ал по-гоÑ?е не Ñ?и вÑ?Ñ?Ñ?и
> Ñ?абоÑ?а поÑ?Ñ?ни какво 
> Ñ?оÑ?но иÑ?каÑ?!
Tova nakratko sa logove sumarizirani po sesii. Podobno
na ciscovskia netflow. Ne sa momentni nito tekushti
stoinosti a prosto logove ot koito se pravi spravka.
Wsichko dotuk dobre - samo che ne znam src-ip-tata
zashtoto te sa internetski i sa nai raznoobrazni :)

> 
> 
> 
> 
> 
> 
>
============================================================================
> A mail-list of Linux Users Group - Bulgaria
> (bulgarian linuxers).
> http://www.linux-bulgaria.org - Hosted by Internet
> Group Ltd. - Stara Zagora
> To unsubscribe:
> http://www.linux-bulgaria.org/public/mail_list.html
>
============================================================================
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.