[Tutor] Parsing iptables log files

Amaya Rodrigo Sastre arodrigo@genasys.com
Mon, 2 Sep 2002 18:06:16 +0200


Dear tutors,

I am a sysadmin fairly new to Python and to programming in general.

I have been asked to code a script that, using iptables, tells how long
an http request takes to be completed in a cluster enviroment with load
balancing and high availability.

My data is collected issuing these commands:

# iptables -A INPUT -p tcp --dport 80 -j LOG --log-prefix "--logtrack-- " --log-tcp-sequence
# iptables -A OUTPUT -p tcp -j LOG --log-prefix "--logtrack-- " --log-tcp-sequence
# grep "\-\-logtrack\-\-" /var/log/syslog > amaya

The script and sample log can be found at:
http://www.amayita.com/~amaya/python/ and are not being posted to this
list because of their size:
amaya@aenima>du *
96K	amaya.bz2
8.0K	amaya.py

I am getting errors I don't fully understand, and I will appreciate any
comments. I love python, but I still don't seem to be proficient enough.
I also am not sure if I am taking the right approach to this issue.

I am using python 2.2. 

Thanks in advance.

-- 
Amaya M. Rodrigo Sastre       Genasys II Spain, S.A.U. 
MLS Sysadmin                    Ventura de la Vega, 5. 
Phone: +34.91.3649100              28014 Madrid. Spain