-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins Core 2.190.1
Logstash Plugin 2.3.1
I came across an error like this:
[logstash-plugin]: Failed to send log data: <URL> [logstash-plugin]: No Further logs will be sent to <URL> java.io.IOException: HTTP error code: 400 RESPONSE: HttpResponseProxy{HTTP/1.1 400 Bad Request [content-type: application/json; charset=UTF-8] org.apache.http.client.entity.DecompressingEntity@3a22308c} {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [data.buildVariables.Foo] of different type, current_type [text], merged_type [ObjectMapper]"}],"type":"illegal_argument_exception","reason":"mapper [data.buildVariables.Foo] of different type, current_type [text], merged_type [ObjectMapper]"},"status":400} at jenkins.plugins.logstash.persistence.ElasticSearchDao.push(ElasticSearchDao.java:190) at jenkins.plugins.logstash.LogstashWriter.write(LogstashWriter.java:172) at jenkins.plugins.logstash.LogstashWriter.writeBuildLog(LogstashWriter.java:137) at jenkins.plugins.logstash.pipeline.LogstashSendStep$Execution.run(LogstashSendStep.java:77) at jenkins.plugins.logstash.pipeline.LogstashSendStep$Execution.run(LogstashSendStep.java:54)
Doing some investigation I found that one of our plugins was adding an environment variable with "." in the name like "foo.bar". When I removed those environment variables it fixed the issue. I believe the logstash plugin could and probably should handle this case in a more graceful way - even if just erroring and saying the variable that can't be sent to Elastic. Or more advanced might be replacing the "." with something else so it just works.
Thanks for the report wbrode
A workaround would be to put logstash in front of your EC and use de_dot filter.
I would be reluctant to add this as default behavior because you can use the ES REST API to also send to Logstash REST.
I think it could be added as optional behavior.
I don't indtend to work on this myself since I find the de_dot workaround sufficient. There is already an abadoned PR trying to solve this issue here: https://github.com/jenkinsci/logstash-plugin/pull/21/files If you want to pick it up I can offer some advice and reviews