Spaces method and path for this operation:
Refer to Spaces for more information.
Create a query pack.
Body
Required
-
The pack description.
-
Enables the pack.
-
Pack-level interval, in seconds. Used when
schedule_typeisinterval. Mutually exclusive withrrule_schedule.Minimum value is
1. -
Minimum osquery version required to run this pack or query. Formatted as a semver string, e.g.
"5.10.0".Minimum length is
1, maximum length is64. -
The pack name.
-
Pack-level platform restriction. To specify multiple platforms, use commas. For example,
linux,darwin.Minimum length is
1, maximum length is256. -
A list of agents policy IDs.
-
An object of queries.
-
Controls the result document type emitted by osquerybeat for this pack or query.
snapshot: Full table snapshot on every scheduled run (default).differential: Rows added or removed since the previous run.differential_added_only: Only rows added since the previous run (no removals).
Values are
snapshot,differential, ordifferential_added_only. -
RRULE schedule configuration consumed by osquerybeat. Loose date forms like
"2024-01-01"are rejected with 400. DTSTART is NOT embedded inrrule; the separatestart_datefield is the schedule anchor. -
Discriminator for the pack's schedule mode.
intervaluses native osqueryd interval scheduling (seconds).rruleuses osquerybeat's RRULE-based recurrence scheduling. Per-query overrides MUST use the same mode as the pack — cross-mode overrides are rejected with 400.Values are
intervalorrrule. -
An object with shard configuration for policies included in the pack. For each policy, set the shard configuration to a percentage (1–100) of target hosts.
curl \
--request POST 'https://<KIBANA_URL>/api/osquery/packs' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"description": "My pack",
"enabled": true,
"name": "my_pack",
"policy_ids": [
"my_policy_id"
],
"queries": {
"ports": {
"ecs_mapping": {
"client.port": {
"field": "port"
}
},
"interval": 60,
"query": "SELECT * FROM listening_ports;",
"timeout": 120
}
}
}'
{
"description": "My pack",
"enabled": true,
"name": "my_pack",
"policy_ids": [
"my_policy_id"
],
"queries": {
"ports": {
"ecs_mapping": {
"client.port": {
"field": "port"
}
},
"interval": 60,
"query": "SELECT * FROM listening_ports;",
"timeout": 120
}
}
}
{
"data": {
"created_at": "2025-02-26T13:37:30.452Z",
"created_by": "elastic",
"description": "My pack",
"enabled": true,
"name": "my_pack",
"policy_ids": [
"my_policy_id"
],
"queries": {
"ports": {
"interval": 60,
"query": "SELECT * FROM listening_ports;",
"removed": false,
"snapshot": true,
"timeout": 120
}
},
"saved_object_id": "1c266590-381f-428c-878f-c80c1334f856",
"shards": [],
"updated_at": "2025-02-26T13:37:30.452Z",
"updated_by": "elastic",
"version": 1
}
}