Skip to content

Commit dc33683

Browse files
committed
Merge pull request ulule#13 from anthroprose/logstash132-tzfix
Logstash132 tzfix
2 parents 896e34b + 5b665c2 commit dc33683

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

logstash_formatter/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def format(self, record):
142142
if 'exc_text' in fields and not fields['exc_text']:
143143
fields.pop('exc_text')
144144

145-
base_log = {'@timestamp': datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
145+
now = datetime.datetime.utcnow()
146+
base_log = {'@timestamp': now.strftime("%Y-%m-%dT%H:%M:%S") + ".%03d" % (now.microsecond / 1000) + "Z",
146147
'@version': 1,
147148
'source_host': self.source_host}
148149
base_log.update(fields)

0 commit comments

Comments
 (0)