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

Always lowercase FQDN #180

Merged
merged 8 commits into from
Jun 1, 2023
Merged

Conversation

ycombinator
Copy link
Contributor

According to https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-name:

[The host.name field] can contain what hostname returns on Unix systems, the fully qualified domain name (FQDN), or a name specified by the user. The recommended value is the lowercase FQDN of the host.

Accordingly, this PR ensures that the FQDN lookup always results in a lowercased FQDN.

@ycombinator ycombinator added the Team:Elastic-Agent Label for the Agent team label May 31, 2023
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 31, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-06-01T14:05:54.379+0000

  • Duration: 5 min 19 sec

Test stats 🧪

Test Results
Failed 0
Passed 161
Skipped 2
Total 163

@andrewkroh
Copy link
Member

Do you think we should also ensure that the Hostname is normalized to lowercase?

@andrewkroh
Copy link
Member

You'll need to add a changelog file as per https://github.com/elastic/go-sysinfo/blob/main/CONTRIBUTING.md.

@ycombinator
Copy link
Contributor Author

Do you think we should also ensure that the Hostname is normalized to lowercase?

Probably. I'll add the change to this PR.

You'll need to add a changelog file as per https://github.com/elastic/go-sysinfo/blob/main/CONTRIBUTING.md.

Thanks, didn't realize this repo now has a changelog - nice!

Copy link

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

There is one more location to update at

h.info.Hostname = v

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

I think it would be helpful to users to indicate in the godocs that the values are lowercased at

Hostname string `json:"name"` // Hostname

FQDN() (string, error)

.changelog/180.txt Outdated Show resolved Hide resolved
ycombinator and others added 2 commits May 31, 2023 17:34
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
types/host.go Outdated Show resolved Hide resolved
types/host.go Outdated Show resolved Hide resolved
ycombinator and others added 2 commits June 1, 2023 07:05
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
@AndersonQ AndersonQ mentioned this pull request Jul 23, 2024
AndersonQ added a commit that referenced this pull request Jul 25, 2024
This PR reverts #180

`Host.FQDNWithContext()` and the deprecated `Host.FQDN()` now return the FQDN as is; it isn't lowercased anymore. This also affects `types.HostInfo#Hostname` which, when it's the FQDN, won't be lowercased.

Complying with ECS for `host.name` and `host.hostname`
(https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-name)
should not be handled by go-sysinfo. The users of go-sysinfo should
ensure compliance with ECS if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants