def __init__(self,*args,**kwargs): self.startDate = kwargs["startDate"] self.endDate = kwargs["endDate"] if self.startDate >= self.endDate: raise ValueError("The start date must be before the end date...") #convert dates to unix timestamp for database queries self.startEpoch = int((self.startDate - dt.datetime(1970,1,1)).total_seconds()) self.endEpoch = int((self.endDate - dt.datetime(1970,1,1)).total_seconds()) #default to latest legion logs database if no platform specified if "platform" in kwargs: self.platform = kwargs["platform"] self.db = platform2database[kwargs["platform"]] else: self.platform = "Legion" self.db = "sgelogs2" #List of users to search for if "usernames" in kwargs: self.usernames = kwargs["usernames"] else: self.usernames = [] #prepare database connection self.dbConnection = logs() #prepare ldap connection for user information query self.ldapConn = ldapConnection() self.query = self.constructQuery()
def __init__(self,*args,**kwargs): startDate = kwargs["startDate"] endDate = kwargs["endDate"] if startDate >= endDate: raise ValueError("The start date must be before the end date...") if "node" in kwargs: self.nodeClass = kwargs["node"] else: self.nodeClass = "all" #default to latest legion logs database if none specified if "db" in kwargs: self.db = kwargs["db"] else: self.db = "sgelogs2" #convert dates to unix timestamp for database queries self.startEpoch = int((startDate - dt.datetime(1970,1,1)).total_seconds()) self.endEpoch = int((endDate - dt.datetime(1970,1,1)).total_seconds()) self.dbConnection = logs() self.constructQuery()
def __init__(self,startDate,endDate): if startDate >= endDate: raise ValueError("The start date must be before the end date...") #convert time to epoch units self.startDate = startDate self.endDate = endDate self.QueryStartEpoch = int((startDate - dt.datetime(1970,1,1)).total_seconds()) # output datetime object properties as epoch self.QueryEndEpoch = int((endDate - dt.datetime(1970,1,1)).total_seconds()) # output datetime object properties as epoch #print "Start date ", self.startDate, " converted to ", self.QueryStartEpoch #print "End date ", self.endDate, " converted to ", self.QueryEndEpoch #prepare the logs to be queried self.log=logs() #prepare ldap connection for user information query self.ldap_con=LDAPCon()