out_splunk: Add auto_extract_timestamp parameter#12143
Conversation
📝 WalkthroughWalkthroughThe Splunk output plugin adds an ChangesSplunk timestamp extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant FluentBit
participant SplunkHTTPReceiver
participant IntegrationTest
FluentBit->>SplunkHTTPReceiver: Send event to selected HEC endpoint
SplunkHTTPReceiver-->>IntegrationTest: Capture request path, query, and authorization
IntegrationTest->>IntegrationTest: Assert payload shape and envelope time
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/integration/scenarios/out_splunk/tests/test_out_splunk_001.py`:
- Around line 72-77: Ensure the test_out_splunk_auto_extract lifecycle always
stops the Service by wrapping wait_for_requests(1) in a try/finally and invoking
service.stop() in the finally block, preserving the existing request-wait
behavior on success and failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 47047932-e017-4df7-8896-c9c9914f1042
📒 Files selected for processing (5)
plugins/out_splunk/splunk.cplugins/out_splunk/splunk.htests/integration/scenarios/out_splunk/config/out_splunk_auto_extract_timestamp.yamltests/integration/scenarios/out_splunk/config/out_splunk_default.yamltests/integration/scenarios/out_splunk/tests/test_out_splunk_001.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f64c0a2ee3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
f64c0a2 to
7a6a694
Compare
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
7a6a694 to
1b58305
Compare
Closes #5566.
wait_for_requests(1)intry/finally, ensuringService.stop()always runs.timefield whenauto_extract_timestampis enabled in bothpack_map()andpack_event_key(). This matches [Splunk’s documented timestamp precedence](https://help.splunk.com/en/splunk-enterprise/get-started/get-data-in/9.4/get-data-with-http-event-collector/http-event-collector-rest-api-endpoints).time.time.event_key.Validation:
cmake --build build --target fluent-bit-bin flb-rt-out_splunk— passed.ctest --test-dir build -R '^flb-rt-out_splunk$' --output-on-failure— passed.out_splunkintegration suite — 3 passed.Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
New Features
auto_extract_timestampoption for the Splunk output (off by default).timefield so Splunk can extract timestamps from event data (including when usingevent_key).auto_extract_timestamp=trueURL parameter.Tests
auto_extract_timestamp, andevent_keytimestamp extraction.timeis present in captured events.