Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default application of json codec and ECS #155

Open
TheVastyDeep opened this issue May 10, 2022 · 2 comments
Open

Default application of json codec and ECS #155

TheVastyDeep opened this issue May 10, 2022 · 2 comments

Comments

@TheVastyDeep
Copy link

For Content-Type application/json the json codec is used by default. That is helpful, but with the introduction of ECS it creates an issue. If the target option on the codec is not set (and the plugin does not set it) then logstash logs an INFO message about ECS compatibility is enabled but target option was not specified. This can be worked around using

additional_codecs => {}
codec => json { target => "[document]" }

but that is not very obvious, and it is not specific to the Content-Type. Perhaps the documentation should address this.

@Eliav2
Copy link

Eliav2 commented Mar 26, 2023

absolutely! took me few hours just to understand how to place the http body fields into the target field. (codec => json { target => "[document]" } is not working unless you specify additional_codecs => {})

@chrisred
Copy link

Plus one on this. I also wasted a couple of hours trying to work out why the target option was not being applied. I found https://discuss.elastic.co/t/json-codec-plugin-target-option-http-input/304217 in the end to point me in the right direction.

I also tried setting

additional_codecs => {
  "application/json" => json {
    target => "[document]"
  }
}

to configure the behaviour for application/json but I got an error, so assume this is not possible? In which case I'm not sure what the benefit of giving additional_codecs a default value even is?

I expect changing the default behaviour now is unlikely to happen. But the need to set additional_codecs => {} should be clearly noted in the documentation at least.

As @TheVastyDeep says, this also is the cause of an unexpected "ECS compatibility" message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants