Skip to content

[Osquery] Enable Results Export feature flag#275597

Merged
tomsonpl merged 15 commits into
elastic:mainfrom
tomsonpl:osquery-enable-export
Jul 3, 2026
Merged

[Osquery] Enable Results Export feature flag#275597
tomsonpl merged 15 commits into
elastic:mainfrom
tomsonpl:osquery-enable-export

Conversation

@tomsonpl

@tomsonpl tomsonpl commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the GA release checklist for Osquery Export Results (security-team#17916).

This PR does two things to take the Export Results feature to GA in 9.5:

  1. Enables the exportResults experimental feature flag by default (false → true). This is what surfaces the "Export results" button in the query-results UI and registers the server-side streaming export endpoints. Matches the prior GA-enablement pattern from [Osquery] FF Enabled for Osquery 9.4 rework  #262693.
  2. Publishes the two export endpoints in the OpenAPI spec. Both _export path operations were already authored but deliberately label-gated off (x-labels: [ ]) behind the flag. Now that the feature is GA, their x-labels are enabled ([ ess, serverless ]) and the bundled osquery OpenAPI schemas are regenerated so the endpoints appear in the published API reference.

Endpoints now documented

  • POST /api/osquery/live_queries/{id}/results/{actionId}/_export
  • POST /api/osquery/scheduled_results/{scheduleId}/{executionCount}/_export

Both support ndjson, json, and csv output formats and stream the result file as an attachment.

Note: oas_docs/output/kibana.yaml / kibana.serverless.yaml are intentionally not modified in this PR — CI's capture_oas_snapshot + make api-docs step regenerates and auto-commits the merged top-level bundle from the osquery source schemas changed here.

Verification

Verified end-to-end in a local Kibana (flag enabled):

  • The "Export results" button renders in the query-results header.
  • Clicking it opens the export modal (File format: CSV / NDJSON / JSON, "Only export filtered results" toggle, "Export N rows").
  • Exporting as CSV downloads a file with the correct header row + result data and full ECS field mapping.
  • Exporting as JSON downloads a file with a _meta block (action_id, execution_count, query text, exported_by, format, total_results) plus the results array.

Screenshots

export-button-visible export-modal

Release note

Osquery query results can now be exported as CSV, JSON, or NDJSON files directly from the query-results page (GA in 9.5).

@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The flag flip and OpenAPI publication look correct and consistent with the route gating (context.experimentalFeatures.exportResults) and the prior GA pattern. One documentation consistency issue on the x-state of the two newly-published export operations is noted inline.

Generated by Claude Reviewer for issue #275597 · 149.8 AIC · ⌖ 10.3 AIC · ⊞ 3.9K

@tomsonpl tomsonpl self-assigned this Jun 30, 2026
@tomsonpl tomsonpl added backport:skip This PR does not require backporting Team:Defend Workflows “EDR Workflows” sub-team of Security Solution release_note:feature Makes this part of the condensed release notes Osquery v9.5.0 labels Jun 30, 2026
…sults/scheduled_results.schema.yaml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@tomsonpl
tomsonpl marked this pull request as ready for review June 30, 2026 16:08
@tomsonpl
tomsonpl requested a review from a team as a code owner June 30, 2026 16:08
@tomsonpl
tomsonpl requested review from pzl and szwarckonrad June 30, 2026 16:08
@tomsonpl

Copy link
Copy Markdown
Contributor Author

/ci

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

@tomsonpl tomsonpl changed the title [Osquery] enable feature flag [Osquery] Enable Results Export feature flag Jun 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Flag flip and OpenAPI publication look correct. One follow-up: the regenerated bundles are out of sync with the corrected scheduled_results source x-state — noted inline. The prior comment on the live-query export x-state still applies on the unchanged source line.

Generated by Claude Reviewer for issue #275597 · 149 AIC · ⌖ 12.2 AIC · ⊞ 3.9K

summary: Export scheduled query results
tags:
- Security Osquery API
x-state: Added in 9.5.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The committed bundle is stale relative to its source schema. The scheduled_results source (common/api/scheduled_results/scheduled_results.schema.yaml) was corrected to x-state: Generally available; Added in 9.5.0, but this generated bundle — and the serverless bundle at the same line — still emit Added in 9.5.0 here, dropping the Generally available; prefix.

These docs/openapi/{ess,serverless}/*.bundled.schema.yaml files are generated from the source schemas via yarn openapi:bundle, so they should be regenerated after the source fix; otherwise the published scheduled-export endpoint renders without the GA indicator (inconsistent with the GA goal and with the sibling scheduled_results GET above, which uses Generally available; Added in 9.4.0).

Re-run yarn openapi:bundle in x-pack/platform/plugins/shared/osquery to refresh both bundles.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: dc2e96d1-89d2-47b4-afd3-7884fb1817b2

📥 Commits

Reviewing files that changed from the base of the PR and between ea3bd1f and 7793ba7.

📒 Files selected for processing (6)
  • x-pack/platform/plugins/shared/osquery/common/api/live_query/live_queries.schema.yaml
  • x-pack/platform/plugins/shared/osquery/common/api/scheduled_results/scheduled_results.schema.yaml
  • x-pack/platform/plugins/shared/osquery/common/experimental_features.ts
  • x-pack/platform/plugins/shared/osquery/docs/openapi/ess/osquery_api_2023_10_31.bundled.schema.yaml
  • x-pack/platform/plugins/shared/osquery/docs/openapi/serverless/osquery_api_2023_10_31.bundled.schema.yaml
  • x-pack/solutions/security/packages/test-api-clients/supertest/osquery.gen.ts
💤 Files with no reviewable changes (1)
  • x-pack/solutions/security/packages/test-api-clients/supertest/osquery.gen.ts

📝 Walkthrough

Walkthrough

The exportResults experimental feature flag default is changed from false to true in experimental_features.ts. The source OpenAPI schemas for the live query and scheduled query export endpoints are updated: x-labels is set to [ess, serverless] and x-state is set to GA, with experimental gating text removed. Bundled OpenAPI specs for both ESS and serverless gain the two export POST operations and five new component schemas (ExportFormat, ExportJsonResponse, ExportMetadata, ExportRequestBody, ExportResultRow). Generated test client JSDoc blocks referencing the experimental flag are removed.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@elastic-vault-github-plugin-prod
elastic-vault-github-plugin-prod Bot requested a review from a team as a code owner June 30, 2026 18:44
@tomsonpl

tomsonpl commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@elastic/ski-docs can I get a review on this one please? :) Thank you!

@bmorelli25 bmorelli25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment above

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The flag flip and OpenAPI publication look correct and consistent with the route gating. One leftover consistency issue: the latest commit corrected the live-query export x-state in the source schema, but the generated bundles (and top-level oas docs) weren't regenerated, so that endpoint still publishes without the Generally available; prefix while its scheduled-export sibling has it. Noted inline with a regeneration reminder — non-blocking.

Generated by Claude Reviewer for issue #275597 · 175.5 AIC · ⌖ 7.41 AIC · ⊞ 3.9K

summary: Export live query results
tags:
- Security Osquery API
x-state: Added in 9.5.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This bundle is stale relative to its source. The latest commit fixed the live-query export x-state in common/api/live_query/live_queries.schema.yaml to Generally available; Added in 9.5.0, but this regenerated bundle wasn't refreshed, so the live-query export endpoint still publishes without the GA prefix — inconsistent with the GA goal and with the sibling OsqueryExportScheduledQueryResults operation below (line 1344), which correctly reads Generally available; Added in 9.5.0.

The serverless bundle at the same line, and the top-level oas_docs/output/kibana.yaml / kibana.serverless.yaml, carry the same stale value. Re-run yarn openapi:bundle in x-pack/platform/plugins/shared/osquery (and let CI regenerate the top-level bundles) so all generated outputs match the corrected source.

Suggested change
x-state: Added in 9.5.0
x-state: Generally available; Added in 9.5.0

summary: Export live query results
tags:
- Security Osquery API
x-state: Added in 9.5.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same stale value as the ESS bundle: the live-query export x-state here still reads Added in 9.5.0, but the source schema was corrected to Generally available; Added in 9.5.0 in the latest commit. Regenerate via yarn openapi:bundle so this bundle matches the source and the sibling scheduled export operation.

Suggested change
x-state: Added in 9.5.0
x-state: Generally available; Added in 9.5.0

@kibanamachine

Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #178 / lens app - group 14 lens workspace size metric size (absolute pixels)

Metrics [docs]

✅ unchanged

History

cc @tomsonpl

@tomsonpl
tomsonpl merged commit 01f4704 into elastic:main Jul 3, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Osquery release_note:feature Makes this part of the condensed release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants