Hi

I'm new to Python and I'm trying to write a script that's count restart of
an application. The log file contains:
2009-03-06 18:20:26,423  User operation - start nanny
2009-03-06 18:20:26,423  User operation - start all services
And 2009-03-06 18:20:26,423  User operation - start all services tells me
that the application has been restarted.

My script do count it, but I cant figure out how to code so it's only get
from to day and 7 day's back.
#Counts restart of an application
count = 0
with open("c:/test/bre.log")as f:
    for line in f:
        if "User operation - start all services" in line:
            count += 1
            #print line.strip()
    print 'Server restart: %s' % count
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to