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

[Filebeat] Fix id for config map #37545

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

constanca-m
Copy link
Contributor

@constanca-m constanca-m commented Jan 4, 2024

This PR is a fix to a bug introduced in #37401.

Defining the id as

id: kubernetes-container-logs-${data.kubernetes.pod.name}-${data.kubernetes.container.id}

Causes the error:

{"log.level":"error","@timestamp":"2024-01-04T13:13:02.933Z","log.origin":{"file.name":"instance/beat.go","file.line":1307},"message":"Exiting: failed to read input configuration: failed to unpack input configuration: missing field accessing 'filebeat.inputs.0.id' (source:'/etc/filebeat.yml')","service.name":"filebeat","ecs.version":"1.6.0"}
Exiting: failed to read input configuration: failed to unpack input configuration: missing field accessing 'filebeat.inputs.0.id' (source:'/etc/filebeat.yml')

We need to remove the fields ${data.*} in the id to fix it.

Signed-off-by: constanca <[email protected]>
@constanca-m constanca-m added the Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team label Jan 4, 2024
@constanca-m constanca-m self-assigned this Jan 4, 2024
@constanca-m constanca-m requested review from a team as code owners January 4, 2024 13:33
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jan 4, 2024
Signed-off-by: constanca <[email protected]>
Copy link
Contributor

mergify bot commented Jan 4, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @constanca-m? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

❕ Build Aborted

Either there was a build timeout or someone aborted the build.

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

Expand to view the summary

Build stats

  • Duration: 37 min 41 sec

🤖 GitHub comments

Expand to view the 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!)

@elasticmachine
Copy link
Collaborator

💚 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

  • Duration: 36 min 4 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the 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!)

@gsantoro
Copy link
Contributor

gsantoro commented Jan 4, 2024

Do you mind updating also:

to keep dev-tools manifests up to date with deploy manifests

@gsantoro gsantoro added the backport-skip Skip notification from the automated backport with mergify label Jan 4, 2024
Signed-off-by: constanca <[email protected]>
@constanca-m constanca-m requested a review from a team as a code owner January 4, 2024 16:27
@elasticmachine
Copy link
Collaborator

💚 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

  • Duration: 135 min 53 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the 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!)

@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Jan 5, 2024
paths:
- /var/log/containers/*.log
parsers:
- container: ~
prospector:
scanner:
fingerprint.enabled: true
fingerprint.length: 300
Copy link
Member

Choose a reason for hiding this comment

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

@constanca-m

By default the length for fingerprint is 1024, which is what is causing the error. We can reduce it to 300 (minimum possible is 64), and that solves the problem.

It's not an error, it's a warning and it's totally normal to have it until the file is large enough to be picked up. The warning needs to be there so the user knows why there are no events coming from a file yet.

Reducing the fingerprint might cause collisions in file identity, lowering the value must be done only if the user is 100% sure that the new amount of characters is always unique for each file. Please keep the value as it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the explanation @rdner , so the warning does not cause unexpected behavior? I will remove that line in that case.

Copy link
Member

Choose a reason for hiding this comment

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

@constanca-m The warning is just to notify the user why the ingestion of the file got delayed. Perhaps we could re-phrase this warning to be more clear and less error-looking. Ideas are welcome.

It does not cause any incorrect/unexpected behaviour, it's a normal state of things.

@@ -113,14 +113,15 @@ data:
filebeat.yml: |-
filebeat.inputs:
- type: filestream
id: kubernetes-container-logs-${data.kubernetes.pod.name}-${data.kubernetes.container.id}
id: kubernetes-container-logs
Copy link
Member

Choose a reason for hiding this comment

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

These substitutions should work only in autodiscover, not in regular input configuration, AFAIK.

I see @gsantoro made this change in #37401
How was it tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not correctly tested in that PR, this is a fix to that

Copy link
Member

Choose a reason for hiding this comment

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

@constanca-m My point is rather if this was not tested, how can we trust the rest of the changes from that PR? Perhaps we need to ask @gsantoro to re-test those changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

hello @rdner , sorry that was my fault. It was an unintended change. I'll do some testing now anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

I have now tested this. it works as expected with this PR changes. thanks @constanca-m for catching this

Signed-off-by: constanca <[email protected]>
@constanca-m constanca-m changed the title [Filebeat] Fix id for config map and fingerprint settings [Filebeat] Fix id for config map Jan 5, 2024
@elasticmachine
Copy link
Collaborator

💚 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

  • Duration: 136 min 56 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the 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!)

Copy link
Member

@rdner rdner left a comment

Choose a reason for hiding this comment

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

LGTM in the current state.

@constanca-m constanca-m merged commit 95f0f85 into elastic:main Jan 8, 2024
94 checks passed
@constanca-m constanca-m deleted the fix-filebeat-config-map branch January 8, 2024 09:47
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants