#!/usr/bin/env python
import re
line = "/var/tmp/ds.log/MacroServer_haspp09_[2016-11-08_00-14-22].log:SardanaTP.W007 ERROR \
2016-11-03 13:44:11,757 p09/door/haspp09.01: An error occurred while running Macro \
'shclose() -> 368fa2ea-a1c3-11e6-831e-54bef70cdbee'"
patt = re.compile( r".*(\d{4})-(\d{2})-(\d{2})\s*(\d{2}):(\d{2}):(\d{2}).*:\s*(.*)'(.*)'")
res = patt.match( line)
if res:
for elm in res.groups():
print( "elm:", elm)
else:
print( "no match")
# output:
# elm: 2016
# elm: 11
# elm: 03
# elm: 13
# elm: 44
# elm: 11
# elm: An error occurred while running Macro
# elm: shclose() -> 368fa2ea-a1c3-11e6-831e-54bef70cdbee