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

Inject host.name field without relying on (component) templates #110938

Conversation

salvatore-campagna
Copy link
Contributor

@salvatore-campagna salvatore-campagna commented Jul 16, 2024

We do not want to rely on templates or component templates to include
the host.name field in indices using LogsDB. The host.name field is a field
we sort on by default when LogsDB is used. As a result, we just inject it
by default, the same way we do for the @timestamp field. This prevents
sorting errors due to missing host.name field in mappings.

The host.name is a keyword field and depending on the value of subobjects it will
be mapped as a name keyword nested inside a host or as a flat host.name keyword.
We also include ignore_above as we normally do for keywords in observability mappings.

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v8.16.0 labels Jul 16, 2024
@salvatore-campagna salvatore-campagna added :StorageEngine/Logs You know, for Logs and removed needs:triage Requires assignment of a team area label labels Jul 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine
Copy link
Collaborator

Hi @salvatore-campagna, I've created a changelog YAML for you.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@salvatore-campagna salvatore-campagna requested review from a team as code owners July 17, 2024 12:16
@salvatore-campagna salvatore-campagna force-pushed the fix/logsdb-host-name-mappings branch 2 times, most recently from 6217258 to b1c4f9e Compare July 17, 2024 12:58
@elasticsearchmachine
Copy link
Collaborator

Hi @salvatore-campagna, I've created a changelog YAML for you.

@salvatore-campagna
Copy link
Contributor Author

@elasticsearchmachine test this please

Copy link
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

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

LGTM. Depending on how we'll implement #110792, we may not need to inject the host.name field in the future anymore.

@salvatore-campagna salvatore-campagna added auto-backport Automatically create backport pull requests when merged and removed auto-backport-and-merge labels Jul 18, 2024
@salvatore-campagna
Copy link
Contributor Author

So I disabled the failing CI test 10_settings.yaml/missing hostname field just to make the CI green and backport to 8.15. After the PR is backported and merged I will re-enable the test in 8.16 too. Of course I will enable the failing test in the backport PR before merging it.

@salvatore-campagna salvatore-campagna merged commit ac2afd7 into elastic:main Jul 18, 2024
15 checks passed
salvatore-campagna added a commit to salvatore-campagna/elasticsearch that referenced this pull request Jul 18, 2024
…astic#110938)

We do not want to rely on templates or component templates to include
the host.name field in indices using LogsDB. The host.name field is a field
we sort on by default when LogsDB is used. As a result, we just inject it
by default, the same way we do for the @timestamp field. This prevents
sorting errors due to missing host.name field in mappings.

The host.name is a keyword field and depending on the value of subobjects it will
be mapped as a name keyword nested inside a host or as a flat host.name keyword.
We also include ignore_above as we normally do for keywords in observability mappings.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.15

salvatore-campagna added a commit that referenced this pull request Jul 18, 2024
…tes (#110938) (#111031)

* Inject `host.name` field without relying on (component) templates (#110938)

We do not want to rely on templates or component templates to include
the host.name field in indices using LogsDB. The host.name field is a field
we sort on by default when LogsDB is used. As a result, we just inject it
by default, the same way we do for the @timestamp field. This prevents
sorting errors due to missing host.name field in mappings.

The host.name is a keyword field and depending on the value of subobjects it will
be mapped as a name keyword nested inside a host or as a flat host.name keyword.
We also include ignore_above as we normally do for keywords in observability mappings.

* Enable missing hostname test
ioanatia pushed a commit to ioanatia/elasticsearch that referenced this pull request Jul 22, 2024
…astic#110938)

We do not want to rely on templates or component templates to include
the host.name field in indices using LogsDB. The host.name field is a field
we sort on by default when LogsDB is used. As a result, we just inject it
by default, the same way we do for the @timestamp field. This prevents
sorting errors due to missing host.name field in mappings.

The host.name is a keyword field and depending on the value of subobjects it will
be mapped as a name keyword nested inside a host or as a flat host.name keyword.
We also include ignore_above as we normally do for keywords in observability mappings.
salvatore-campagna added a commit to salvatore-campagna/elasticsearch that referenced this pull request Jul 23, 2024
…astic#110938)

We do not want to rely on templates or component templates to include
the host.name field in indices using LogsDB. The host.name field is a field
we sort on by default when LogsDB is used. As a result, we just inject it
by default, the same way we do for the @timestamp field. This prevents
sorting errors due to missing host.name field in mappings.

The host.name is a keyword field and depending on the value of subobjects it will
be mapped as a name keyword nested inside a host or as a flat host.name keyword.
We also include ignore_above as we normally do for keywords in observability mappings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants