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

[libbeat | filebeat] Log error when parsing config block and disabled input on filebeat #30534

Merged
merged 12 commits into from
Mar 2, 2022

Conversation

AndersonQ
Copy link
Member

@AndersonQ AndersonQ commented Feb 22, 2022

What does this PR do?

Improve logging on filebeat to show better what happens when it's parsing the configs.

Why is it important?

Stop omitting errors and will help to investigate #30533

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
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 22, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 22, 2022

This pull request does not have a backport label. Could you fix it @AndersonQ? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Feb 22, 2022
@AndersonQ AndersonQ requested a review from ph February 22, 2022 14:36
@AndersonQ AndersonQ added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Feb 22, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 22, 2022
@AndersonQ AndersonQ added backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify needs_team Indicates that the issue/PR needs a Team:* label labels Feb 22, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 22, 2022
@botelastic
Copy link

botelastic bot commented Feb 22, 2022

This pull request doesn't have a Team:<team> label.

@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Feb 22, 2022
@AndersonQ AndersonQ changed the title log error and disabled input on filebeat [libbeat | filebeat] Log error when parsing config block and disabled input on filebeat Feb 22, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 22, 2022

💚 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: 2022-03-02T16:09:07.464+0000

  • Duration: 133 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 42995
Skipped 3846
Total 46841

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Feb 22, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b filebeat-improve-logs upstream/filebeat-improve-logs
git merge upstream/main
git push upstream filebeat-improve-logs

Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

Added a small suggestion around the wording of the log message for the harvester, other than that LGTM.

@@ -105,7 +105,7 @@ func (c *crawler) Start(
}()
}

log.Infof("Loading and starting Inputs completed. Enabled inputs: %v", len(c.inputs))
log.Infof("Loading and starting Inputs completed. Enabled inputs: %d", len(c.inputs))

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndersonQ The len() is a good start but let's be more precise like having a detailed count for each input. IE. Filestream input: 2, same comment for this log statement.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm logging the input config keys now on startInput now.
The inputs field doesn't have much information to log, it's an implementation of Runner :/

filebeat/input/log/harvester.go Show resolved Hide resolved
@@ -256,8 +257,8 @@ func (cm *Manager) apply(blocks ConfigBlocks) error {
}

// Unset missing configs
for name := range missing {
if missing[name] {
for name, isMissing := range missing {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 nice change.

AndersonQ and others added 4 commits February 23, 2022 10:07
Co-authored-by: Pier-Hugues Pellerin <phpellerin@gmail.com>
@AndersonQ
Copy link
Member Author

/test

1 similar comment
@AndersonQ
Copy link
Member Author

/test

@AndersonQ
Copy link
Member Author

/test

Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

Changes LGTM.

This PRs improves logging for the management and filebeat input.
We should do something similar for to others beats too. But's let's get this merged.

// TODO: Either use debug or remove it after https://github.com/elastic/beats/pull/30534
// is fixed.
c.log.Infof("starting input, keys present on the config: %v",
config.FlattenedKeys())
Copy link
Contributor

Choose a reason for hiding this comment

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

++ for not leaking senstitive information.

@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b filebeat-improve-logs upstream/filebeat-improve-logs
git merge upstream/main
git push upstream filebeat-improve-logs

@AndersonQ AndersonQ merged commit b25fdf6 into main Mar 2, 2022
@AndersonQ AndersonQ deleted the filebeat-improve-logs branch March 2, 2022 18:33
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
…30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

# Conflicts:
#	filebeat/beater/crawler.go
#	libbeat/tests/system/beat/beat.py
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
…30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

# Conflicts:
#	filebeat/beater/crawler.go
#	libbeat/tests/system/beat/beat.py
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
…30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

# Conflicts:
#	filebeat/beater/crawler.go
#	libbeat/tests/system/beat/beat.py
AndersonQ pushed a commit that referenced this pull request Mar 3, 2022
… input

* log error when parsing config block and disabled input on filebeat (#30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)
Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
AndersonQ added a commit that referenced this pull request Mar 3, 2022
… input

* log error when parsing config block and disabled input on filebeat (#30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
AndersonQ added a commit that referenced this pull request Mar 3, 2022
…d input

* log error when parsing config block and disabled input on filebeat (#30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…lastic#30534)

- log error when parsing config block and disabled input on filebeat
- adjust tests and add an optional error message for 'wait_until' on libbeat python tests

(cherry picked from commit b25fdf6)

# Conflicts:
#	filebeat/beater/crawler.go
#	libbeat/tests/system/beat/beat.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants