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

Rename host.name to host.hostname and add config option for name #9943

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Jan 8, 2019

Currently by default the hostname of the host on which the Beat is running is fed into host.name. Based on ECS this is now changed to host.hostname: https://github.com/elastic/ecs#-host-fields By default host.name stays the hostname of the host for backward compatibility. It is not set by the processor but by the pipeline.

If the config option name is changed in the Beat config, host.name will be set to this value as before. In addition a new config option was added to add_host_metadata:

processors:
  - add_host_metadata:
      name: foo

name for the host metadata processor can be set and will overwrite the current value of host.name.

It is also possible to set both config options as below:

name: bar

processors:
  - add_host_metadata:
      name: foo

The outcome event will contain the following two fields:

agent.name: bar
host.name: foo

Overall if nothing is configured, the behavior stays the same as before but allows additional options.

@ruflin ruflin self-assigned this Jan 8, 2019
@ruflin ruflin requested a review from a team as a code owner January 8, 2019 09:39
@ruflin
Copy link
Member Author

ruflin commented Jan 8, 2019

@urso Could you see this breaking something?
@graphaelli Would be good to get your eyes on this too in case it could have an affect on APM.

@ruflin ruflin requested review from urso and graphaelli January 8, 2019 09:40
@ruflin ruflin mentioned this pull request Jan 8, 2019
@@ -68,7 +68,7 @@ func ReportInfo(_ monitoring.Mode, V monitoring.Visitor) {
}
info := h.Info()

monitoring.ReportString(V, "name", info.Hostname)
monitoring.ReportString(V, "hostname", info.Hostname)
Copy link
Member Author

Choose a reason for hiding this comment

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

@ycombinator This affects the monitoring reporting. Will this break something?

Copy link
Contributor

@ycombinator ycombinator Jan 8, 2019

Choose a reason for hiding this comment

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

I checked docs in the .monitoring-beats-* indices, and this field will end up as beats_state.state.host.hostname in those docs after this PR, in place of beats_state.state.host.name today. The latter is not being used anywhere in the Stack Monitoring UI code, so this change should be safe.

We will however, want to update the mapping here: https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/resources/monitoring-beats.json#L52-L54.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ycombinator Could you tackle the update of the template?

Copy link
Contributor

Choose a reason for hiding this comment

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

Currently by default the hostname of the host on which the Beat is running is fed into host.name. Based on ECS this is now changed to `host.hostname`: https://github.com/elastic/ecs#-host-fields By default `host.name` stays the hostname of the host for backward compatibility. It is not set by the processor but by the pipeline.

If the config option `name` is changed in the Beat config, `host.name` will be set to this value as before. In addition a new config option was added to `add_host_metadata`:

```
processors:
  - add_host_metadata:
      name: foo
```

`name` for the host metadata processor can be set and will overwrite the current value of `host.name`.

It is also possible to set both config options as below:

```
name: bar

processors:
  - add_host_metadata:
      name: foo
```

The outcome event will contain the following two fields:

```
agent.name: bar
host.name: foo
```

Overall if nothing is configured, the behavior stays the same as before but allows additional options.
Copy link
Member

@graphaelli graphaelli left a comment

Choose a reason for hiding this comment

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

lgtm. apm-server does not support using the add_host_metadata processor. elastic/apm-server#1684 is related.

@urso
Copy link

urso commented Jan 8, 2019

@urso Could you see this breaking something?

CI is green, but I still wonder about dashboards/visualizations/ml jobs/infra UI potentially using the field. This could also break links to dashboards with filters set on host.name.

@ruflin
Copy link
Member Author

ruflin commented Jan 9, 2019

@urso As host.name is not removed in the events everything should keep working for dashboards and linking. But I might miss something here.

@urso
Copy link

urso commented Jan 9, 2019

But I might miss something here.

me as well :)
But as it's not removed yet I don't think we will run into major problems here.

@ruflin ruflin merged commit 5a5da1b into elastic:master Jan 10, 2019
@ruflin ruflin deleted the rename-name-to-hostname branch January 10, 2019 07:52
ycombinator added a commit to elastic/elasticsearch that referenced this pull request Jan 14, 2019
This new `hostname` field is meant to be a replacement for its sibling `name` field. See elastic/beats#9943, particularly elastic/beats#9943 (comment).

This PR simply adds the new field (`hostname`) to the mapping without removing the old one (`name`), because a user might be running an older-version Beat (without this field rename in it) with a newer-version Monitoring ES cluster (with this PR's change in it).

AFAICT the Monitoring UI isn't currently using the `name` field so no changes are necessary there yet. If it decides to start using the `name` field, it will also want to look at the value of the `hostname` field.
2lambda123 pushed a commit to 2lambda123/elastic-elasticsearch that referenced this pull request May 2, 2024
This new field is meant to be a replacement for its sibling name field. See elastic/beats#9943.
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.

5 participants