Logstash mapping not working correctly

Really unclear as to what I need to do to make this work right. My logs coming from my Python application are nested within "message" rather than being mapped to the proper fields.

Notice how "message" has all the contents that the mapping would normally look for as distinct properties like "@timestamp". What the message is supposed to say is "Serving on http://0.0.0.0:8180"

Here's what I'm sending to logstash:

{'@timestamp': '2021-06-20T01:26:35.743Z', '@message': 'Serving on http://0.0.0.0:8180', '@source': 'logstash://DESKTOP-M87VCB0/C:\\Users\\Jeremy\\PycharmProjects\\comparebench\\venv\\lib\\site-packages\\waitress\\wasyncore.py', '@source_host': 'DESKTOP-M87VCB0', '@source_path': 'C:\\Users\\Jeremy\\PycharmProjects\\comparebench\\venv\\lib\\site-packages\\waitress\\wasyncore.py', '@tags': [], '@type': 'logstash', '@fields': {'levelname': 'INFO', 'logger': 'waitress', 'stack_info': None}}

I have no clue how to fix this and "logstash mapping not working" isn't a very easy google search. I'm using the python-logstash library and the Pyramid framework, using this to hook into python's logging:

host = '192.168.1.177'
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.addHandler(logstash.TCPLogstashHandler(host, 5000, version=0))

Please do not post pictures of text. Just post the text. You can copy the contents of the [message] field by expanding an event in Discover and then clicking on the JSON tab.

Your message is JSON. If you do not parse it with either json codec or a json filter then it will be sent to elasticsearch unmodified.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.