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

Fix loading processors from autodiscover hints #16348

Merged
merged 3 commits into from
Feb 18, 2020

Conversation

blakerouse
Copy link
Contributor

What does this PR do?

Fixes an issue where processors from autodiscover hints where not convered into a common.MapStr.

Why is it important?

Allows processors to be defined in autodiscover hints.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • Converts string to common.MapStr

How to test this PR locally

Run filebeat with:

filebeat.autodiscover:
  providers:
    - type: docker
      hints.enabled: true

output.console:
  pretty: true

Start container with processor:

docker run -l 'co.elastic.logs/processors.add_fields={"fields":{"foo":"bar"}}' busybox echo hello

Check that filebeat was able to start logging it the container with the fields added.

Related issues

Use cases

Screenshots

Logs

if str, ok := value.(string); ok {
cfg := common.MapStr{}
if err := json.Unmarshal([]byte(str), &cfg); err != nil {
logp.Debug("autodiscover.builder", "unable to unmarshal json due to error: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be logp.Debugf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked the code, seems logp.Debug is correct. It accepts parameters for the format string.

@blakerouse blakerouse merged commit d1f383f into elastic:master Feb 18, 2020
@blakerouse blakerouse deleted the fix-autodiscover-processors branch February 18, 2020 17:38
@blakerouse blakerouse added the needs_backport PR is waiting to be backported to other branches. label Feb 18, 2020
@blakerouse blakerouse added v7.7.0 and removed needs_backport PR is waiting to be backported to other branches. labels Feb 18, 2020
blakerouse added a commit to blakerouse/beats that referenced this pull request Feb 18, 2020
* Parse processors from hints as JSON.

* Add test.

* Add changelog entry.

(cherry picked from commit d1f383f)
@blakerouse blakerouse added containers Related to containers use case Team:Platforms Label for the Integrations - Platforms team labels Feb 18, 2020
blakerouse added a commit that referenced this pull request Feb 18, 2020
…ints (#16391)

* Fix loading processors from autodiscover hints (#16348)

* Parse processors from hints as JSON.

* Add test.

* Add changelog entry.

(cherry picked from commit d1f383f)

* Remove bad changelog entry.

* Add back space that editor auto stripped.
kvch pushed a commit to kvch/beats that referenced this pull request Feb 20, 2020
* Parse processors from hints as JSON.

* Add test.

* Add changelog entry.
@blakerouse blakerouse added the test-plan Add this PR to be manual test plan label Mar 27, 2020
@andresrc andresrc added the test-plan-added This PR has been added to the test plan label Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Related to containers use case Team:Platforms Label for the Integrations - Platforms team test-plan Add this PR to be manual test plan test-plan-added This PR has been added to the test plan v7.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Filebeat] Autodiscovery logs.processors does not convert string into a MapStr
3 participants