Skip to content

Commit

Permalink
fixing last date issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jullrich committed Sep 21, 2023
1 parent f64d7e9 commit f7e1e1d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions srv/dshield/fwlogparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def parse(logline,logformat,linere):

else:
d.log("Bad format specified: {}".format(logformat))

if logdata['time'] > startdate:
if debug>0:
print("processing ", logdata['time'], startdate)
parts = fwdata.split()
logdata['flags'] = ''
for part in parts:
Expand Down Expand Up @@ -153,11 +154,16 @@ def checklock(lockfile):
d.log("New Startdate")
startdate = 0
f.close()
if startdate>10000000000:
if debug>0:
print("resetting startdate to lower value ",startdate)
startdate = 0
if debug > 0:
d.log("Startdate %d file %s" % (startdate,lastcount))
skip=1
currenttime=round(time())
d.log("Current Time %s" % (currenttime))

if ( startdate<currenttime-86400):
startdate=currenttime-86400;
d.log("Correcting Startdate to %d" % (startdate) )
Expand Down Expand Up @@ -211,7 +217,7 @@ def checklock(lockfile):
d.log("processed %d lines total and %d new lines and ended at %s" % (i, j, lastdate))

f = open(lastcount, 'w')
f.write(str(lastdate))
f.write("%.0f" % lastdate)
f.close()
if ( j == maxlines ):
d.log("incrementing skip value from %d" % (skip))
Expand Down

0 comments on commit f7e1e1d

Please sign in to comment.