Skip to content

Cherry-pick #20305 to 7.8: [Autodiscovery] Ignore ErrInputNotFinished errors in autodiscover config checks#20339

Merged
ChrsMark merged 2 commits intoelastic:7.8from
ChrsMark:backport_20305_7.8
Jul 30, 2020
Merged

Cherry-pick #20305 to 7.8: [Autodiscovery] Ignore ErrInputNotFinished errors in autodiscover config checks#20339
ChrsMark merged 2 commits intoelastic:7.8from
ChrsMark:backport_20305_7.8

Conversation

@ChrsMark
Copy link
Copy Markdown
Member

@ChrsMark ChrsMark commented Jul 30, 2020

Cherry-pick of PR #20305 to 7.8 branch. Original message:

What does this PR do?

This PR ignores ErrInputNotFinished error occur in autodiscover stop/start process. This is required in order to avoid having stoped configs that never come back since the start event fails due to this error on first attempt if the previous state is not cleaned yet.

Currently configs that fail due to ErrInputNotFinished are skipped at

. However, this is not a config error but a state error and in that case we need to add them in the list of configs at
a.configs[eventID][hash] = &reload.ConfigWithMeta{
so as to be handled properly by the retry mechanism of autodiscover at
retry = err != nil

Why is it important?

In order to resolve a permanent issue with updated Pods, which makes Filebeat stop collecting logs after a Pod is updated.

How to test this PR locally

  1. Deploy Filebeat on k8s using the following config for autodiscover (set a valid output too so as to ship logs to ES):
filebeat.autodiscover:
  providers:
    - type: kubernetes
      node: ${NODE_NAME}
      templates:
        - condition:
            equals:
              kubernetes.pod.name: "mytarget3"
          config:
            - type: container
              paths:
                - /var/log/containers/*${data.kubernetes.container.id}.log
  1. While Filebeat is up and running deploy a target pod to be autodiscovered and make Filebeat collects its logs:
---
apiVersion: v1
kind: Pod
metadata:
  name: mytarget3
  labels:
    app: test
spec:
  containers:
    - name: test
      image: ubuntu:latest
      command:
        - bash
        - -c
        - |
          #!/bin/bash
          echo "$(date): started the process"

          while :
          do
                 echo "$(date): sleeping 5 seconds"
                 sleep 5
          done
  1. Update the target Pod's manifest by adding an extra label like team: qa
  2. apply the Pod's update with kubectl apply -f <manifest_filename>.yml
  3. Make sure that after a while, Filebeat continues collecting logs after the update of the Pod.

@ChrsMark ChrsMark added [zube]: In Review backport Team:Platforms Label for the Integrations - Platforms team labels Jul 30, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 30, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/integrations-platforms (Team:Platforms)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 30, 2020
@botelastic
Copy link
Copy Markdown

botelastic bot commented Jul 30, 2020

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

@ChrsMark ChrsMark requested review from a team and jsoriano July 30, 2020 07:22
@ChrsMark ChrsMark closed this Jul 30, 2020
Copy link
Copy Markdown
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

LGTM, @ChrsMark wdyt about merging this in case there is a 7.8.2 release?

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jul 30, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Started by user Chris Mark, Replayed #2]

  • Start Time: 2020-07-30T09:17:17.860+0000

  • Duration: 52 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 3790
Skipped 683
Total 4473

Steps errors

Expand to view the steps failures

  • Name: Report to Codecov
    • Description: curl -sSLo codecov https://codecov.io/bash for i in auditbeat filebeat heartbeat libbeat metricbeat packetbeat winlogbeat journalbeat do FILE="${i}/build/coverage/full.cov" if [ -f "${FILE}" ]; then bash codecov -f "${FILE}" fi done

    • Duration: 2 min 22 sec

    • Start Time: 2020-07-30T10:03:35.868+0000

    • log

@ChrsMark ChrsMark reopened this Jul 30, 2020
@zube zube bot added [zube]: Inbox and removed [zube]: Done labels Jul 30, 2020
@ChrsMark ChrsMark merged commit 18a1efe into elastic:7.8 Jul 30, 2020
@zube zube bot added [zube]: Done and removed [zube]: Inbox labels Jul 30, 2020
@zube zube bot removed the [zube]: Done label Oct 28, 2020
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…inished errors in autodiscover config checks (elastic#20339)

* [Autodiscovery] Ignore ErrInputNotFinished errors in autodiscover config checks (elastic#20305)

(cherry picked from commit 8d2bc1f)

* Update CHANGELOG.next.asciidoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Team:Platforms Label for the Integrations - Platforms team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants