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. -
The pack name.
-
A list of agents policy IDs.
-
An object of queries.
-
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
}
}