You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using logstash 8.4.2, I get the following error from logstash when using a simple example with version=1 formatter.
[2022-09-22T12:25:39,507][ERROR][logstash.codecs.json][main][3d55bea51246de48d1dcce7bf9f91a050ba59de18eabf4f05de2ead10f5d45ae]
JSON parse error, original data now in message field
{:message=>"Could not set field 'ip' on object ‘mymachine.local' to value '127.0.0.1'.This is probably due to trying to set a field like [foo][bar] = someValuewhen [foo] is not either a map or a string",
:exception=>Java::OrgLogstash::Accessors::InvalidFieldSetException, :data=>"{\"@timestamp\": \"2022-09-22T09:25:39.434Z\", \"@version\": \"1\", \"message\": \"this is a warning\", \"host\": \"mymachine.local\", \"path\": \"/Users/eren/src/log/test.py\", \"tags\": [], \"type\": \"logstash\", \"level\": \"WARNING\", \"logger_name\": \"__main__\"}"}
The root cause of the problem seems to be Could not set field 'ip' on object 'betelgeuse.local' to value '127.0.0.1’.. It looks like logstash tries to add ip to host field, however this field is not a dictionary and is sent by logstash-python as a string.
When I remove L125 and do not send host field, everything works perfectly. self.host is populated in the base class and it’s understandable that FQDN may be sent. However, If we don’t send host field at all, logstash already adds ip field. Effectively, this code block with default settings is useless:
I do not know how host field is used in the earlier versions of logstash, or if it’s useable at all. However, sending host field in the log message breaks logstash 8.4.2 and it cannot properly write the log. I simply removed sending host field and started using the library with a fork until the issue is resolved.
I’m reporting this issue in the hopes that google will index. I spent a whole day trying to understand logstash, google answers, cryptic error messages etc. If you are seeing this error, simply remove sending host field and you should be good to go until a fix is released.
Best,
Eren
The text was updated successfully, but these errors were encountered:
TBH, the message design could also use a general cleaning up to adhere to the ECS spec. logger_name should be log.logger, level should be log.level, host should be log.syslog.hostname etc.
Using logstash 8.4.2, I get the following error from logstash when using a simple example with
version=1
formatter.The root cause of the problem seems to be
Could not set field 'ip' on object 'betelgeuse.local' to value '127.0.0.1’.
. It looks like logstash tries to addip
tohost
field, however this field is not a dictionary and is sent by logstash-python as a string.python-logstash/logstash/formatter.py
Lines 117 to 125 in a795733
When I remove L125 and do not send
host
field, everything works perfectly.self.host
is populated in the base class and it’s understandable that FQDN may be sent. However, If we don’t sendhost
field at all, logstash already addsip
field. Effectively, this code block with default settings is useless:python-logstash/logstash/formatter.py
Lines 18 to 21 in a795733
I do not know how host field is used in the earlier versions of logstash, or if it’s useable at all. However, sending
host
field in the log message breaks logstash 8.4.2 and it cannot properly write the log. I simply removed sendinghost
field and started using the library with a fork until the issue is resolved.I’m reporting this issue in the hopes that google will index. I spent a whole day trying to understand logstash, google answers, cryptic error messages etc. If you are seeing this error, simply remove sending
host
field and you should be good to go until a fix is released.Best,
Eren
The text was updated successfully, but these errors were encountered: