Hello.
New user of logstash here so please bear with me!
Sending over TCP from python using logstash_async, I receive the item in logstash (see bottom of message). How can I parse the "message" into fields?
I have tried to use the below filter but then the messages stop parsing:
filter {
json {
source => "message"
}
}
Thank you.
{
"_index": ".ds-logs-generic-default-2023.05.15-000001",
"_id": "ID7EKIgBdldke0oWVk1p",
"_version": 1,
"_score": 0,
"_source": {
"@version": "1",
"@timestamp": "2023-05-17T08:12:15.741219356Z",
"event": {
"original": "{\"@timestamp\": \"2023-05-17T08:12:15.308Z\", \"@version\": \"1\", \"host\": \"Razor17\", \"level\": \"INFO\", \"logsource\": \"Razor17\", \"message\": \"test sending to logstash remotely\", \"pid\": 51968, \"program\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"type\": \"python-logstash\", \"extra\": {\"func_name\": \"<module>\", \"interpreter\": \"c:\\\\Users\\\\benoi\\\\PycharmProjects\\\\venv310\\\\Scripts\\\\python.exe\", \"interpreter_version\": \"3.10.2\", \"line\": 2931, \"logger_name\": \"__main__\", \"logstash_async_version\": \"2.5.0\", \"path\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"process_name\": \"MainProcess\", \"thread_name\": \"MainThread\"}}"
},
"message": "{\"@timestamp\": \"2023-05-17T08:12:15.308Z\", \"@version\": \"1\", \"host\": \"Razor17\", \"level\": \"INFO\", \"logsource\": \"Razor17\", \"message\": \"test sending to logstash remotely\", \"pid\": 51968, \"program\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"type\": \"python-logstash\", \"extra\": {\"func_name\": \"<module>\", \"interpreter\": \"c:\\\\Users\\\\benoi\\\\PycharmProjects\\\\venv310\\\\Scripts\\\\python.exe\", \"interpreter_version\": \"3.10.2\", \"line\": 2931, \"logger_name\": \"__main__\", \"logstash_async_version\": \"2.5.0\", \"path\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"process_name\": \"MainProcess\", \"thread_name\": \"MainThread\"}}",
"type": "python-tcp",
"data_stream": {
"type": "logs",
"dataset": "generic",
"namespace": "default"
}
},
"fields": {
"@timestamp": [
"2023-05-17T08:12:15.741Z"
],
"event.original": [
"{\"@timestamp\": \"2023-05-17T08:12:15.308Z\", \"@version\": \"1\", \"host\": \"Razor17\", \"level\": \"INFO\", \"logsource\": \"Razor17\", \"message\": \"test sending to logstash remotely\", \"pid\": 51968, \"program\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"type\": \"python-logstash\", \"extra\": {\"func_name\": \"<module>\", \"interpreter\": \"c:\\\\Users\\\\benoi\\\\PycharmProjects\\\\venv310\\\\Scripts\\\\python.exe\", \"interpreter_version\": \"3.10.2\", \"line\": 2931, \"logger_name\": \"__main__\", \"logstash_async_version\": \"2.5.0\", \"path\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"process_name\": \"MainProcess\", \"thread_name\": \"MainThread\"}}"
],
"data_stream.namespace": [
"default"
],
"data_stream.dataset": [
"generic"
],
"@version": [
"1"
],
"type": [
"python-tcp"
],
"message": [
"{\"@timestamp\": \"2023-05-17T08:12:15.308Z\", \"@version\": \"1\", \"host\": \"Razor17\", \"level\": \"INFO\", \"logsource\": \"Razor17\", \"message\": \"test sending to logstash remotely\", \"pid\": 51968, \"program\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"type\": \"python-logstash\", \"extra\": {\"func_name\": \"<module>\", \"interpreter\": \"c:\\\\Users\\\\benoi\\\\PycharmProjects\\\\venv310\\\\Scripts\\\\python.exe\", \"interpreter_version\": \"3.10.2\", \"line\": 2931, \"logger_name\": \"__main__\", \"logstash_async_version\": \"2.5.0\", \"path\": \"C:\\\\Users\\\\benoi\\\\PycharmProjects\\\\pythonProject\\\\ExcelSheets\\\\snippets.py\", \"process_name\": \"MainProcess\", \"thread_name\": \"MainThread\"}}"
],
"data_stream.type": [
"logs"
]
}
}