Esempio n. 1
0
def clean(event):
  
    try:
        event["epoch"] = carny.guess(event["date_time"])
    except Exception as e:
        print("event is mis-formatted")
        print(e)
        return None

    return event
Esempio n. 2
0
def gen_clean(events, used, name):
    '''Take in an event iterable, log type, and a file name
and use the latter two to enrich the event and give the event
an epoch timestamp as well as ensure that there are no unprintable
hex characters. Yields a dictionary representing a cleaned event.'''

    for e in events:
        if e is not None:
            if used in unspecified:
                e["date_time"] = e["date_time"].strip()+" 2006"
            try:
                e["epoch"] = carny.guess(e["date_time"])
                                
            except Exception as e:
                print("ERROR: event is mis-formatted: %s" % str(e))
                yield None
            
            
            e['type'] = used
            e['file_name'] = name
            
            c = utf8_check(e)
            yield c