count_unique_values
Count unique values of a field in Datadog logs to find distinct sessions, users, or IPs without fetching all logs.
Instructions
Count UNIQUE values of a field (distinct count / cardinality).
PERFECT for counting unique sessions, users, IPs, etc. Much more efficient than fetching all logs with search_logs and counting distinct values client-side.
Use this when:
"How many unique users/sessions?"
"Count distinct values"
"How many different X?"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | Field to count unique values of (e.g. "@session_id", "@user.id", "host") | |
| query | Yes | Search query using Datadog log search syntax | |
| indexes | No | Optional list of index names to search | |
| to_time | Yes | End time - same accepted formats as from_time | |
| from_time | Yes | Start time - ISO 8601, relative date math (e.g. "now-1h"), or a millisecond timestamp |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||