Skip to content

auditbeat: adapt to quark 0.8 backend flags and since-boot times - #52623

Merged
nicholasberlin merged 3 commits into
mainfrom
auditbeat-quark-0.8
Sep 14, 2026
Merged

nicholasberlin merged 3 commits into
mainfrom
auditbeat-quark-0.8

Conversation

@nicholasberlin

@nicholasberlin nicholasberlin commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Proposed commit message

quark 0.8 hands out Proc.TimeBoot and Exit.ExitTimeProcess as nanoseconds since boot instead of since the epoch (see quark CHANGES, 0.7→0.8). Without conversion, process.start/process.end would be dated shortly after 1970. This PR:

  • Converts with the new quark.TimeToWallclock() at every site that feeds process.start/process.end, in both auditbeat quark consumers (sessionmd kerneltracingprovider and the system/process quark provider). Emitted events are unchanged.
  • Keeps the boottime epoch fresh across system clock steps (e.g. NTP correcting a clock that was wrong at boot): quark caches the epoch at quark_queue_open() and keeping it honest is the consumer's job. Both providers call quark.UpdateBoottime() on their existing 5-second stats cadence: it re-reads /proc/stat btime, which is stable between reads and only moves on a step, and quark stores it only when it actually changed. Corrections apply retroactively to anything translated afterwards.

The backend flag changes (QQ_ALL_BACKENDS removal, explicit ebpf→kprobe fallback) landed separately in #52574

Why it is important

Once beats picks up a go-quark release with quark ≥ 0.8, timestamps would silently break; this PR makes the conversion explicit and step-proof ahead of that.

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 N/A
  • I have made corresponding change to the default configuration files N/A
  • I have added tests that prove my fix is effective or that my feature works (existing root-only integration tests cover both providers; updated in-place)
  • I have added an entry in ./changelog/fragments using the changelog tool

Dependency

Resolved: elastic/go-quark#40 merged and go-quark v0.8.0 is released; go.mod now pins go-quark v0.8.0 (NOTICE regenerated).

How to test this PR locally

cd x-pack/auditbeat/module/system/process
sudo go test -run 'TestQuarkMetricSet|TestForkExecExit|TestInitialSnapshot' ./...

Verified locally: go vet and go test -c (compile+link) of both packages against the rebuilt go-quark static lib.

Related issues

@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 13, 2026
@botelastic

botelastic Bot commented Aug 13, 2026

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@mergify

mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @nicholasberlin? 🙏.
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-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@nicholasberlin
nicholasberlin force-pushed the auditbeat-quark-0.8 branch 2 times, most recently from cc51227 to 6470567 Compare August 14, 2026 13:01
@github-actions

This comment has been minimized.

@nicholasberlin

Copy link
Copy Markdown
Contributor Author

the latest commit: 6470567 may have thread access issues. need to investigate before merging.

@nicholasberlin
nicholasberlin marked this pull request as ready for review August 25, 2026 15:57
@nicholasberlin
nicholasberlin requested review from a team as code owners August 25, 2026 15:57
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The Buildkite x-pack/auditbeat: Run check/update failure is a format/update drift issue: mage check auto-formats one test line in quark_provider_linux_test.go, then fails because the tree is dirty.

Remediation

  • Run cd x-pack/auditbeat && mage fmt (or make check) and commit the resulting formatting change in x-pack/auditbeat/module/system/process/quark_provider_linux_test.go.
  • Re-run the Buildkite x-pack/auditbeat: Run check/update job to confirm the workspace stays clean after check/update.
Investigation details

Root Cause

This is not a runtime/test assertion failure. It is a formatting consistency failure in one line of the test file.

dev-tools/mage/check.go:66-68 raises:
"some files are not up-to-date. Run 'make update' then review and commit the changes."
when any file changes during mage check.

In an isolated checkout of PR head (c22909425a79389121760c31c8097853470d89fe), make check reformatted:

  • x-pack/auditbeat/module/system/process/quark_provider_linux_test.go:263

Generated diff:

-"process.parent.pid":                    uint32(os.Getppid()), (nolint/redacted):gosec // PID values fit in uint32
+"process.parent.pid":                    uint32(os.Getppid()),                                         (nolint/redacted):gosec // PID values fit in uint32

Evidence

  • Build: https://buildkite.com/elastic/beats/builds/51855
  • Job/step: x-pack/auditbeat: Run check/update
  • Key log excerpt:
    • Error: some files are not up-to-date. Run 'make update' then review and commit the changes. Modified: [x-pack/auditbeat/module/system/process/quark_provider_linux_test.go]

Verification

  • Ran locally in isolated worktree at PR head: cd x-pack/auditbeat && make check
  • The formatter reported and modified exactly one file: module/system/process/quark_provider_linux_test.go

Follow-up

No code logic change is indicated by this failure; committing the formatter output should unblock this Buildkite step.


What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@nicholasberlin

Copy link
Copy Markdown
Contributor Author

the latest commit: 6470567 may have thread access issues. need to investigate before merging.

there wasn't an actual issue, but here's the PR which addresses it by adding atomic functions: elastic/quark#393

@nicholasberlin
nicholasberlin enabled auto-merge (squash) August 26, 2026 11:10
@mergify

mergify Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@github-actions github-actions Bot mentioned this pull request Aug 31, 2026
@nicholasberlin
nicholasberlin force-pushed the auditbeat-quark-0.8 branch 2 times, most recently from acb8447 to e80cadc Compare September 8, 2026 18:21
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

TL;DR

golangci-lint failed in lint (ubuntu-latest) because the Cloud Foundry dependency github.com/cloudfoundry-community/go-cfclient was not loaded successfully, which then surfaced as undefined: cfclient typecheck errors. Immediate action: re-run the workflow; if it reproduces, investigate module download/proxy stability for that dependency in the lint environment.

Remediation

  • Re-run this workflow run path first; the primary failure signal includes a Go module fetch stream error from https://proxy.golang.org/.../go-cfclient/...zip.
  • If the failure repeats, harden the lint environment around dependency fetches (for example by pre-downloading modules in the job or adding retry around module download) and then rerun lint.
Investigation details

Root Cause

The failing job is lint (ubuntu-latest) at step golangci-lint. Check-run annotations for this exact failed job show a module download stream error for go-cfclient, followed by typecheck failures where cfclient symbols are unresolved in Cloud Foundry code.

Evidence

  • Workflow: https://github.com/elastic/beats/actions/runs/34358196713
  • Job/step: lint (ubuntu-latest) → golangci-lint
  • Key log excerpt:
    • github.com/cloudfoundry-community/go-cfclient@v0.0.0-20190808214049-35bcce23fc5f: read "https://proxy.golang.org/github.com/cloudfoundry-community/go-cfclient/@v/v0.0.0-20190808214049-35bcce23fc5f.zip": stream error: stream ID 833; INTERNAL_ERROR; received from peer) (typecheck)
    • x-pack/libbeat/common/cloudfoundry/dopplerconsumer.go:158:10: undefined: cfclient (typecheck)
    • x-pack/libbeat/common/cloudfoundry/cache.go:24: undefined: cfclient (typecheck)
    • x-pack/libbeat/common/cloudfoundry/cache.go:62: undefined: cfclient (typecheck)

Validation

  • Not run (read-only detective workflow).

Follow-up

  • This differs from the last PR Actions Detective report on this PR (which was a gosec finding in auditbeat tests); the current failure is a new lint/typecheck issue centered on Cloud Foundry dependency resolution in Ubuntu lint.

What is this? | From workflow: PR Actions Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

quark 0.8 hands out Proc.TimeBoot and Exit.ExitTimeProcess as
nanoseconds since boot instead of since the epoch (quark CHANGES
0.7->0.8): without conversion, process.start and process.end would be
dated shortly after 1970. Convert with the new quark.TimeToWallclock()
everywhere they feed process.start and process.end, in both quark
providers. Emitted events are unchanged.

quark's boottime epoch, cached at quark_queue_open(), also moves when
the system clock is stepped (say NTP correcting a clock that was wrong
at boot), and keeping it fresh is the consumer's job. Both providers
call quark.UpdateBoottime() on their existing 5-second stats cadence:
it re-reads /proc/stat btime, which is stable between reads and only
moves on a step, and quark stores it only when it actually changed.
Corrections apply retroactively to anything translated afterwards.

The backend flag changes (QQ_ALL_BACKENDS removal) landed separately
in #52574.

go-quark is pinned to a pre-release of the 0.8 update
(elastic/go-quark#40) and will be bumped to the tagged release before
merging.
@nicholasberlin
nicholasberlin merged commit 7b4b565 into main Sep 14, 2026
211 checks passed
@nicholasberlin
nicholasberlin deleted the auditbeat-quark-0.8 branch September 14, 2026 10:18
christos68k added a commit that referenced this pull request Nov 12, 2026
* [auditbeat] Replace use of QQ_ALL_BACKENDS (#52574)

The quark attribute flag QQ_ALL_BACKENDS is being removed in future versions of go-quark. This removes its use from auditbeat.

Instead of using QQ_ALL_BACKENDS, consumers will be responsible for explicitly setting the backend to be used, and retrying with a different backend in case of failure. Now auditbeat will attempt eBPF first, then attempt kprobe if it fails; this is the same behaviour quark has with QQ_ALL_BACKENDS

(cherry picked from commit 6861354)

* auditbeat: adapt to quark 0.8 backend flags and since-boot times (#52623)

* auditbeat: adapt to quark 0.8 since-boot timestamps

quark 0.8 hands out Proc.TimeBoot and Exit.ExitTimeProcess as
nanoseconds since boot instead of since the epoch (quark CHANGES
0.7->0.8): without conversion, process.start and process.end would be
dated shortly after 1970. Convert with the new quark.TimeToWallclock()
everywhere they feed process.start and process.end, in both quark
providers. Emitted events are unchanged.

quark's boottime epoch, cached at quark_queue_open(), also moves when
the system clock is stepped (say NTP correcting a clock that was wrong
at boot), and keeping it fresh is the consumer's job. Both providers
call quark.UpdateBoottime() on their existing 5-second stats cadence:
it re-reads /proc/stat btime, which is stable between reads and only
moves on a step, and quark stores it only when it actually changed.
Corrections apply retroactively to anything translated afterwards.

The backend flag changes (QQ_ALL_BACKENDS removal) landed separately
in #52574.

go-quark is pinned to a pre-release of the 0.8 update
(elastic/go-quark#40) and will be bumped to the tagged release before
merging.

* auditbeat: pin go-quark to v0.8.0

* auditbeat: fix goimports alignment in quark test

(cherry picked from commit 7b4b565)

* auditbeat: update for quark 0.9 changes (#53284)

* auditbeat: update for quark 0.9 changes

* auditbeat: update go-quark to v0.9.0

* auditbeat: add fragment

* auditbeat: review feedback on quark 0.9 update

(cherry picked from commit 181205b)

Co-authored-by: Michael Wolf <michael.wolf@elastic.co>
Co-authored-by: Nicholas Berlin <56366649+nicholasberlin@users.noreply.github.com>
christos68k added a commit that referenced this pull request Nov 12, 2026
* [auditbeat] Replace use of QQ_ALL_BACKENDS (#52574)

The quark attribute flag QQ_ALL_BACKENDS is being removed in future versions of go-quark. This removes its use from auditbeat.

Instead of using QQ_ALL_BACKENDS, consumers will be responsible for explicitly setting the backend to be used, and retrying with a different backend in case of failure. Now auditbeat will attempt eBPF first, then attempt kprobe if it fails; this is the same behaviour quark has with QQ_ALL_BACKENDS

(cherry picked from commit 6861354)

* auditbeat: adapt to quark 0.8 backend flags and since-boot times (#52623)

* auditbeat: adapt to quark 0.8 since-boot timestamps

quark 0.8 hands out Proc.TimeBoot and Exit.ExitTimeProcess as
nanoseconds since boot instead of since the epoch (quark CHANGES
0.7->0.8): without conversion, process.start and process.end would be
dated shortly after 1970. Convert with the new quark.TimeToWallclock()
everywhere they feed process.start and process.end, in both quark
providers. Emitted events are unchanged.

quark's boottime epoch, cached at quark_queue_open(), also moves when
the system clock is stepped (say NTP correcting a clock that was wrong
at boot), and keeping it fresh is the consumer's job. Both providers
call quark.UpdateBoottime() on their existing 5-second stats cadence:
it re-reads /proc/stat btime, which is stable between reads and only
moves on a step, and quark stores it only when it actually changed.
Corrections apply retroactively to anything translated afterwards.

The backend flag changes (QQ_ALL_BACKENDS removal) landed separately
in #52574.

go-quark is pinned to a pre-release of the 0.8 update
(elastic/go-quark#40) and will be bumped to the tagged release before
merging.

* auditbeat: pin go-quark to v0.8.0

* auditbeat: fix goimports alignment in quark test

(cherry picked from commit 7b4b565)

* auditbeat: update for quark 0.9 changes (#53284)

* auditbeat: update for quark 0.9 changes

* auditbeat: update go-quark to v0.9.0

* auditbeat: add fragment

* auditbeat: review feedback on quark 0.9 update

(cherry picked from commit 181205b)
(cherry picked from commit a998fe3)

Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
Co-authored-by: Michael Wolf <michael.wolf@elastic.co>
Co-authored-by: Nicholas Berlin <56366649+nicholasberlin@users.noreply.github.com>
@vishaangelova vishaangelova mentioned this pull request Nov 23, 2026
1 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs_team Indicates that the issue/PR needs a Team:* label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants