Skip to content

Instantly share code, notes, and snippets.

@espenfjo
Created November 6, 2013 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save espenfjo/7344907 to your computer and use it in GitHub Desktop.
Save espenfjo/7344907 to your computer and use it in GitHub Desktop.
def __init__(self, alert):
text_parts = alert.split("[**]")
print text_parts
self.alarm_text = (re.compile("\[\d+:\d+:\d+\]").split(text_parts[1]))[1].strip()
space_parts = alert.split(" ")
print space_parts
self.classification = ((text_parts[2].split("["))[1]).split("]")[0]
pri = (re.compile("\s+").split((((text_parts[2].split("["))[2]).split("]")[0])))[1]
self.priority = int(pri)
self.time = space_parts[0]
self.dst = (((text_parts[2].split("} "))[1]).split("->"))[0]
self.src = (((text_parts[2].split("} "))[1]).split("-> "))[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment