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

Update hostname for version1 #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neofob
Copy link

@neofob neofob commented Apr 27, 2022

logstash/formatter.py:

  • On logstash 8.x (maybe earlier too), the ip of the sender will be
    the field "host":{"ip": sender_ip}
logstash         | {
logstash         |          "event" => {
logstash         |         "original" => "{}\n"
logstash         |     },
logstash         |       "@version" => "1",
logstash         |           "host" => {
logstash         |         "ip" => "172.21.56.1"
logstash         |     },
logstash         |     "@timestamp" => 2022-04-22T00:23:19.214302Z

So when we send the field "host": hostname, it will cause json parsing
error in logstash receiver.

Signed-off-by: Tuan T. Pham [email protected]

logstash/formatter.py:
    * On logstash 8.x (maybe earlier too), the ip of the sender will be
the field "host":{"ip": sender_ip}
```
logstash         | {
logstash         |          "event" => {
logstash         |         "original" => "{}\n"
logstash         |     },
logstash         |       "@Version" => "1",
logstash         |           "host" => {
logstash         |         "ip" => "172.21.56.1"
logstash         |     },
logstash         |     "@timestamp" => 2022-04-22T00:23:19.214302Z
```
So when we send the field "host": hostname, it will cause json parsing
error in logstash receiver.

Signed-off-by: Tuan T. Pham <[email protected]>
Copy link

@vtoupet vtoupet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirme that this works perfectly and PR can be safely be merged (testing with ELK 8.5.2).
@vklochan, if you are not happy with this change could you please let us know what is blocking this PR from being merged?

@RomkaSk
Copy link

RomkaSk commented Apr 25, 2023

Also works fine for me.
This problem is described in more detail here: https://discuss.elastic.co/t/problem-logstash-outputs-elasticsearch-could-not-index-event-to-elasticsearch-wazuh-alerts-3-x-2020-05-30/235038/6
The field name hostname corresponds to the ECS documentation - https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-hostname

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

Successfully merging this pull request may close these issues.

3 participants