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

Use IndexPrefix for kafka and logstash output. #10841

Merged
merged 3 commits into from
Feb 25, 2019

Conversation

simitt
Copy link
Contributor

@simitt simitt commented Feb 20, 2019

Writing to ES output libbeat falls back to use beat.Info.IndexPrefix as default index, if nothing else is configured. Using logstash or kafka, libbeat uses beat.Info.Beat as default index.
In case IndexPrefix and Beat is not the same, the resulting index in ES differs.

This PR intends to fix this inconsistency.

fixes #10839

@simitt simitt added bug needs_backport PR is waiting to be backported to other branches. labels Feb 20, 2019
@simitt simitt requested a review from a team as a code owner February 20, 2019 10:55
@@ -46,7 +46,7 @@ func makeLogstash(
cfg *common.Config,
) (outputs.Group, error) {
if !cfg.HasField("index") {
cfg.SetString("index", -1, beat.Beat)
cfg.SetString("index", -1, beat.IndexPrefix)
Copy link

Choose a reason for hiding this comment

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

We should separate config unpacking into a separate function and create tests (file config_test.go) for config unpacking edge cases.

common pattern:

func readConfig(in *common.Config) (Config, error) {
   ...
}

@urso
Copy link

urso commented Feb 22, 2019

Thanks for adding tests. Run make fmt to add missing license headers.

@simitt
Copy link
Contributor Author

simitt commented Feb 25, 2019

@urso I update the license headers. Failing test seems unrelated afaics.

@urso
Copy link

urso commented Feb 25, 2019

I restarted the Travis one. At least one should be green.

@simitt
Copy link
Contributor Author

simitt commented Feb 25, 2019

jenkins, retest this please

Copy link

@urso urso left a comment

Choose a reason for hiding this comment

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

travis has been green. beats-ci failures due to network failures in tests, but unrelated to this change. Kafka + LS tests passed on all CI systems.

@simitt simitt merged commit a08af68 into elastic:master Feb 25, 2019
simitt added a commit to simitt/beats that referenced this pull request Feb 25, 2019
Output index differed to Elasticsearch output.

fixes elastic#10839
simitt added a commit to simitt/beats that referenced this pull request Feb 25, 2019
Output index differed to Elasticsearch output.

fixes elastic#10839
simitt added a commit to simitt/beats that referenced this pull request Feb 28, 2019
simitt added a commit to simitt/beats that referenced this pull request Feb 28, 2019
simitt added a commit to simitt/beats that referenced this pull request Feb 28, 2019
simitt added a commit that referenced this pull request Feb 28, 2019
* Use IndexPrefix for kafka and logstash output. (#10841)

Output index differed to Elasticsearch output.

fixes #10839
simitt added a commit that referenced this pull request Feb 28, 2019
* Use IndexPrefix for kafka and logstash output. (#10841)

Output index differed to Elasticsearch output.

fixes #10839
@simitt simitt deleted the master-fix-output-index branch May 6, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs_backport PR is waiting to be backported to other branches.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index Prefix in ES differs between ES and logstash or kafka output
2 participants