Changeset 63:dde8ac8eb16d in livinglogic.python.tipimaid

Show
Ignore:
Timestamp:
01/05/09 16:55:21 (10 years ago)
Author:
Nikolas Tautenhahn <nik@…>
Branch:
default
Message:

ignore malformed loglines

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • liaalh.py

    r38 r63  
    8484    def run_unbuffered(self): 
    8585        for (server, data) in self.readlines(): 
    86             datestring = self.re_find_date.findall(data)[0] 
    87             utclogdate = self.apachedate2utc(datestring) 
    88             self.writeline(utclogdate, server, data) 
     86            try: 
     87                datestring = self.re_find_date.findall(data)[0] 
     88                utclogdate = self.apachedate2utc(datestring) 
     89                self.writeline(utclogdate, server, data) 
     90            except IndexError, exc: # index error bc we didn't find an apache date -> malformed logline 
     91                continue # ignore it 
    8992 
    9093    def run_buffered(self): 
     
    99102                    utclogdate = self.apachedate2utc(datestring) 
    100103                    self.add(LogLine((utclogdate, server, data))) 
     104                except IndexError, exc: # index error bc we didn't find an apache date -> malformed logline 
     105                    continue # ignore it 
    101106                except Exception, exc: 
    102107                    print server, data