Created
March 9, 2015 12:00
-
-
Save rlindooren/e600c59b68801cc6273d to your computer and use it in GitHub Desktop.
Simple Python script that can convert Elasticsearch JSON output (based on Log4j events logged via Logstash) to human readable text
This file contains 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
#!/usr/bin/python | |
import sys | |
import json | |
jsonData = json.load(sys.stdin) | |
for hit in jsonData["hits"]["hits"]: | |
source = hit["_source"] | |
print "{0} {1:<5} - <{2}> {3}.{4}.({5}): {6}".format(source["@timestamp"], source["priority"], source["thread"], source["class"], source["method"], source["file"], source["message"]) | |
if "stack_trace" in source: | |
print "{0}".format(source["stack_trace"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment