-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Enhanncement for host.ip and host.mac] Disabling netinfo.enabled option of add-host-metadata processor #36506
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d7a20b7
adding check for host processor in case of K8s
gizas 3c9f832
adding check for host processor in case of K8s
gizas 9dbd74f
Updating root file to only have env variable check
gizas 37b40d9
Adding comment
gizas 96f32f9
Adding CHANGELOG.next.asciidoc
gizas 41c0534
Adding comments for the change introduced
gizas beb7e85
Adding comments for the change introduced
gizas 1daafec
Merge branch 'main' of github.com:elastic/beats into fixinghostips
gizas 1c5541e
Adding comments for the change introduced
gizas c1313cf
Adding filebeat fix
gizas bc4f64e
Adding fix only t add-host-metadata processor and removed per beats
gizas 27d147a
Adding fix only t add-host-metadata processor and removed per beats
gizas 6a03eb4
Adding comments
gizas d26c658
Changing variable to ELASTIC_NETINFO
gizas a7ed8ee
Updating changelof for variable ELASTIC_NETINFO
gizas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,6 +18,7 @@ | |||||||||||||||||||||||||||||||||||||||||
package add_host_metadata | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
import ( | ||||||||||||||||||||||||||||||||||||||||||
"os" | ||||||||||||||||||||||||||||||||||||||||||
"time" | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
"github.com/elastic/beats/v7/libbeat/processors/util" | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -34,10 +35,24 @@ type Config struct { | |||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
func defaultConfig() Config { | ||||||||||||||||||||||||||||||||||||||||||
return Config{ | ||||||||||||||||||||||||||||||||||||||||||
NetInfoEnabled: true, | ||||||||||||||||||||||||||||||||||||||||||
CacheTTL: 5 * time.Minute, | ||||||||||||||||||||||||||||||||||||||||||
ExpireUpdateTimeout: time.Second * 10, | ||||||||||||||||||||||||||||||||||||||||||
ReplaceFields: true, | ||||||||||||||||||||||||||||||||||||||||||
// Setting environmental variable NETINFO:false in Elastic Agent pod will disable the netinfo.enabled option of add_host_metadata processor | ||||||||||||||||||||||||||||||||||||||||||
// This will result to events not being enhanced with host.ip and host.mac | ||||||||||||||||||||||||||||||||||||||||||
// Related to https://github.com/elastic/integrations/issues/6674 | ||||||||||||||||||||||||||||||||||||||||||
valueNETINFO, _ := os.LookupEnv("NETINFO") | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if valueNETINFO == "false" { | ||||||||||||||||||||||||||||||||||||||||||
return Config{ | ||||||||||||||||||||||||||||||||||||||||||
NetInfoEnabled: false, | ||||||||||||||||||||||||||||||||||||||||||
CacheTTL: 5 * time.Minute, | ||||||||||||||||||||||||||||||||||||||||||
ExpireUpdateTimeout: time.Second * 10, | ||||||||||||||||||||||||||||||||||||||||||
ReplaceFields: true, | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||
return Config{ | ||||||||||||||||||||||||||||||||||||||||||
NetInfoEnabled: true, | ||||||||||||||||||||||||||||||||||||||||||
CacheTTL: 5 * time.Minute, | ||||||||||||||||||||||||||||||||||||||||||
ExpireUpdateTimeout: time.Second * 10, | ||||||||||||||||||||||||||||||||||||||||||
ReplaceFields: true, | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+43
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional suggestion to increase readability
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only question would be the naming we want to choose here. Maybe sth like
ELASTIC_NETINFO
would be more explicit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree lets not introduce a breaking change (I was thinking an old comment you had done).
For the naming you are killing me :) but I was expecting the debate , so seeing the page again https://www.elastic.co/guide/en/fleet/current/agent-environment-variables.html, I would go for ELASTIC_AGENT_NETINFO as strickly speaking this is a change on the agent side.
I would wait until tomorrow to see if others have any opinion and I would need to change all prs