Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jun 6, 2025

Proposed commit message

I think this is a breaking change that we need to address ASAP, hence tagging this PR as impact:critical.

This PR moves logging initialisation before we move forward with rest of the flow.

Issues:

  1. We initialise logger at

    b.Info.Logger, err = configure.LoggingWithTypedOutputsLocal(b.Info.Beat, b.Config.Logging, b.Config.EventLogging, logp.TypeKey, logp.EventType)
    if err != nil {
    return fmt.Errorf("error initializing logging: %w", err)
    }
    // extracting here for ease of use
    logger := b.Info.Logger

    But, we make use of logger in promoteOutputQueueSettings, which called is before logger's initialisation
    if err := promoteOutputQueueSettings(b); err != nil {
    return fmt.Errorf("could not promote output queue settings: %w", err)
    }

    b.Info.Logger.Info("global queue settings replaced with output queue settings")

    Logger doesn't exist at this point and it leads to a nil dereference panic.

  2. We don't really see the panic message. The command just exits without any meaningful info. We log the panic here, we make use of logp.NewLogger(...). It is a no-op logger if haven't configured the logger in the first place.

How to reproduce

Just run filebeat in normal mode with following config and you'll see nothing. No log files created, no panics printed:

filebeat.inputs:
  - type: filestream
    id: filestream-input-id
    enabled: true
    paths:
      - ./logs/file.log

output:
  elasticsearch:
    hosts: ["host"]
    username: elastic
    password: REDACTED
    bulk_max_size: 5000
    queue:
        mem:
          events: 3200
          flush:
            min_events: 1600
            timeout: 1s

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.

Disruptive User Impact

* fix a breaking bug

* remove panic

* fix log config

* changelog

* fix test

* no changelog

* fix OverwriteSettings

(cherry picked from commit 3604ffa)

# Conflicts:
#	libbeat/cmd/instance/beat.go
@mergify mergify bot requested a review from a team as a code owner June 6, 2025 04:36
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Jun 6, 2025
@mergify mergify bot requested review from AndersonQ and VihasMakwana and removed request for a team June 6, 2025 04:36
@mergify
Copy link
Contributor Author

mergify bot commented Jun 6, 2025

Cherry-pick of 3604ffa has failed:

On branch mergify/bp/8.19/pr-44131
Your branch is up to date with 'origin/8.19'.

You are currently cherry-picking commit 3604ffadd.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   libbeat/cmd/instance/beat.go

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 6, 2025
@github-actions github-actions bot added bug impact:critical Immediate priority; high value or cost to the product. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Jun 6, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 6, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert
Copy link
Contributor

#44684 is required before moving on with that one.

@mergify
Copy link
Contributor Author

mergify bot commented Jun 6, 2025

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 mergify/bp/8.19/pr-44131 upstream/mergify/bp/8.19/pr-44131
git merge upstream/8.19
git push upstream mergify/bp/8.19/pr-44131

@khushijain21 khushijain21 enabled auto-merge (squash) June 6, 2025 07:59
@khushijain21
Copy link
Contributor

Closing this, will get fixed other backports

auto-merge was automatically disabled June 6, 2025 07:59

Pull request was closed

@mergify mergify bot deleted the mergify/bp/8.19/pr-44131 branch June 6, 2025 08:00
@pierrehilbert
Copy link
Contributor

@khushijain21 just to be sure to understand, why did you close this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug conflicts There is a conflict in the backported pull request impact:critical Immediate priority; high value or cost to the product. Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants