Skip to content

[Osquery_manager] Add pack_name and query_name fields for scheduled queries#20017

Open
marc-gr wants to merge 3 commits into
elastic:mainfrom
marc-gr:feat/osquery_manager-pack-name-query-name
Open

[Osquery_manager] Add pack_name and query_name fields for scheduled queries#20017
marc-gr wants to merge 3 commits into
elastic:mainfrom
marc-gr:feat/osquery_manager-pack-name-query-name

Conversation

@marc-gr

@marc-gr marc-gr commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds two keyword fields to the osquery_manager package data streams:

  • pack_name — human-readable pack name for scheduled queries that belong to a pack.
  • query_name — the query name (the pack's queries config map key) for scheduled queries that belong to a pack.

Both fields are added to:

  • data_stream/result (primary-fields.yml) — osquery result documents.
  • data_stream/action_responses (action-responses.yml) — synthetic scheduled response documents.

The legacy pack dashboards and saved searches (Compliance pack, OSSEC rootkit pack) previously matched scheduled queries by action_id only. They are updated to match action_id OR (pack_name AND query_name) so they keep working for both legacy documents and documents produced after the beats change.

Package version bumped 1.30.01.30.1 with bugfix changelog entries.

Why is it important?

Osquerybeat now emits pack_name and query_name on scheduled pack query result and response documents (companion change on the beats side), and no longer sets action_id for scheduled queries. The Osquery Manager dashboards group and label scheduled query results by pack and query name; without mappings for these fields and updated filters, the dashboards cannot render those results correctly.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to the Kibana version support policy.

How to test this PR locally

  1. Build the package (elastic-package build) and boot the stack (elastic-package stack up -d).
  2. Install the package (elastic-package install).
  3. Ingest scheduled pack query documents in both shapes into logs-osquery_manager.result-default:
    • legacy: action_id: "pack_<pack>_<query>"
    • new: pack_name, query_name, schedule_id (no action_id), with realistic osquery.* fields per query.
  4. Open the two dashboards and the five saved searches and confirm both legacy and new documents are matched.

Verification performed

Verified against a local elastic-package stack (Elasticsearch/Kibana 9.5.0-SNAPSHOT) with package 1.30.1 installed. Realistic per-query documents were ingested in both shapes (legacy action_id and new pack_name+query_name with action_id absent), then the dashboards and saved searches were driven headlessly with Playwright.

Saved searches (Discover) — each returns both shapes with the expected columns populated:

Saved search Docs (legacy + new) Filter type
Mounts 6 (3 + 3) custom bool.should
DEB packages installed 6 (3 + 3) custom bool.should
OSSEC Rootkits 6 (3 + 3) custom bool.should
OS versions 4 (2 + 2) KQL OR
Kernel integrations 4 (2 + 2) KQL OR

Dashboards — 0 "No results" panels and 0 panel errors on both:

  • OSSEC rootkit pack — the "hosts infected" metric counts both legacy and new hosts; the embedded search shows legacy rows (action_id = pack_ossec-rootkit) and new rows (action_id = (null), matched via pack_name).
  • Compliance pack — the Mounts-by-type donut, OS-versions donut, "Live Kernel integrations" gauge, and the DEB packages / Mounts tables all populate from both document shapes.

New documents show action_id = (null) in Discover yet still appear, confirming they match on pack_name + query_name, while legacy documents continue to match on action_id.

Related issues

…ueries

Add pack_name and query_name keyword fields to the result and action_responses
data streams. Osquerybeat now emits these on scheduled pack query result and
response documents (pack_name from the pack config, query_name from the pack's
queries config map key). The Osquery Manager dashboards need them to group and
label scheduled query results by pack and query name.
@marc-gr marc-gr requested a review from a team as a code owner July 7, 2026 13:18
@marc-gr marc-gr added bugfix Pull request that fixes a bug issue Integration:osquery_manager Osquery Manager Team:Defend Workflows Security team for Endpoint and OSQuery workflows [elastic/security-defend-workflows] labels Jul 7, 2026
@marc-gr marc-gr requested review from pzl and tomsonpl July 7, 2026 13:18
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

…_name/query_name

Update the Compliance pack and OSSEC rootkit pack dashboards and their saved
searches to match scheduled queries by action_id OR (pack_name AND query_name),
so they keep working for both legacy documents and documents produced after
osquerybeat stopped setting action_id for scheduled queries.
@marc-gr marc-gr added the dashboard Relates to a Kibana dashboard bug, enhancement, or modification. label Jul 8, 2026
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown

✅ All changelog entries have the correct PR link.

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@tomsonpl tomsonpl 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.

Reviewed alongside the Kibana (elastic/kibana#276690) and osquerybeat (elastic/beats#51781) PRs. The pack_name / query_name mappings and the action_id OR (pack_name AND query_name) filter migration match the fields osquerybeat now emits, and keeping the legacy action_id clause means old documents still resolve — that looks like the right backwards-compatible approach to me. Two small things I wanted to confirm, inline.

- name: pack_id
type: keyword
description: Pack identifier for scheduled queries that belong to a pack.
- name: pack_name

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.

Small consistency check: here in the result data stream the new fields are keyword without ignore_above, while the same two fields in data_stream/action_responses/fields/action-responses.yml set ignore_above: 1024. Is that difference intentional, or would it be worth aligning the two definitions?

name: osquery_manager
title: Osquery Manager
version: 1.30.0
version: 1.30.1

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 checklist notes the Kibana version constraints weren't verified. Since these fields only populate once the companion Kibana (elastic/kibana#276690) and osquerybeat (elastic/beats#51781) changes ship, is the current conditions.kibana.version still appropriate for 1.30.1, or should it be bumped to align with the stack version that starts emitting pack_name / query_name?

@mergify

mergify Bot commented Jul 9, 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

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

Labels

bugfix Pull request that fixes a bug issue dashboard Relates to a Kibana dashboard bug, enhancement, or modification. Integration:osquery_manager Osquery Manager Team:Defend Workflows Security team for Endpoint and OSQuery workflows [elastic/security-defend-workflows]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants