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

Support to exclude fields from concatenate_all_fields #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ypid-geberit
Copy link

@ypid-geberit ypid-geberit commented Oct 8, 2018

Status: Feature complete. Need to rebase and fix/add unit tests ontop of #41.
This implements #43

I plan to rebase when #41 is merged because I developed those two features in a row as I needed them for our environment. Feel free to review this already: 42e8f23

Consider this example:

```JSON
{
  "@timestamp": "2023-05-23T23:23:23.555Z",
  "@Version": "1",
  "beat": {
    "hostname": "gnu.example.com",
    "name": "gnu.example.com",
    "version": "5.2.2"
  },
  "host": "gnu.example.com"
}
```

Using this filter:

```Logstash
fingerprint {
  concatenate_all_fields => true
  target => "[@metadata][_id]"
  method => "SHA512"
  key => "XXX"
  base64encode => true
}
```

Here, the order of the `.beat` hash is non-deterministic and the plugin
did not do a deep sort as part of the serialization. This resulted in
different fingerprints for the same event because the order of the three
keys (hostname, name, version) changed randomly in the serialization.

This has been fixed by recursively checking for hashes and serializing
them in sorted order.

Note that this changes the serialization format and thus breaks
backwards compatibility. The old format could be emulated in order to
not break backwards compatibility. Backwards compatibility in this case
means to generate the same fingerprint for the same input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants