Created
July 25, 2018 04:15
-
-
Save mikechau/358e92dcd3bca0df66e03b3d4497c84a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /var/log/logstash/logstash-plain.log | grep -o "^\[.*\]\[DEBUG\]\[logstash.outputs.amazones\]" | awk '{ gsub(/\[DEBUG\].*/, ""); print }' | sed 's/[][]//g' | sed 's/,.*//g' | python timediff.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dateutil.parser | |
import sys | |
counter = 0 | |
ptime = None; | |
for line in sys.stdin: | |
ctime = dateutil.parser.parse(line) | |
if counter == 0: | |
ptime = ctime | |
print('[{}]: {}'.format(counter, '0:00:00')) | |
else: | |
dtime = ctime - ptime | |
print('[{}]: {}'.format(counter, dtime)) | |
ptime = ctime | |
counter +=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment