Datadog Log Aggregation API

Aggregate and analyze log data

Operations 1

POST /api/v2/logs/analytics/aggregate Datadog Aggregate Logs #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/datadog-log-aggregation-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

datadog-log-aggregation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Datadog Logs Log Aggregation API
  description: The Datadog Logs API allows you to search and send log events to the Datadog platform over HTTP. It supports querying and aggregating log data from the Log Management product. Logs can be searched using Datadog's log query language, and results can be aggregated using facets and measures. The API also supports managing log indexes, which control how long logs are retained and queried.
  version: v2
  contact:
    name: Datadog Support
    url: https://www.datadoghq.com/support/
  termsOfService: https://www.datadoghq.com/legal/terms/
servers:
- url: https://api.datadoghq.com
  description: Datadog API Production Server
security:
- apiKeyAuth: []
tags:
- name: Log Aggregation
  description: Aggregate and analyze log data
paths:
  /api/v2/logs/analytics/aggregate:
    post:
      operationId: aggregateLogs
      summary: Datadog Aggregate Logs
      description: Computes aggregations over log events matching a search query within a specified time range. Supports count, sum, avg, min, max, and percentile aggregations grouped by one or more facets. Results can be used for building analytics charts, dashboards, and reports. Useful for answering questions like "how many errors per service per hour?" or "what is the p99 latency by endpoint?".
      tags:
      - Log Aggregation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogsAggregateRequest'
      responses:
        '200':
          description: Successful response with aggregated log analytics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogsAggregateResponse'
        '400':
          description: Bad request - invalid aggregation query or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '401':
          description: Unauthorized - missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '403':
          description: Forbidden - insufficient permissions for this operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    LogsAggregateRequest:
      type: object
      description: Request body for aggregating log events
      properties:
        filter:
          $ref: '#/components/schemas/LogsQueryFilter'
        compute:
          type: array
          description: List of aggregation computations to perform on the filtered log set
          items:
            $ref: '#/components/schemas/LogsCompute'
        group_by:
          type: array
          description: List of facets to group results by, enabling breakdown by log attribute
          items:
            $ref: '#/components/schemas/LogsGroupBy'
        options:
          type: object
          description: Options for the aggregation query
          properties:
            timezone:
              type: string
              description: The timezone to use for time-based group-by operations (IANA timezone name)
    LogsAggregateBucket:
      type: object
      description: A single aggregation bucket representing one group-by combination
      properties:
        by:
          type: object
          description: The facet values that define this bucket
          additionalProperties:
            type: string
        computes:
          type: object
          description: The computed aggregation values for this bucket, keyed by computation index
          additionalProperties: true
    LogsQueryFilter:
      type: object
      description: Filter criteria for log search queries
      properties:
        query:
          type: string
          description: A Datadog log search query string to filter log events (e.g., service:web status:error)
          example: avg:system.cpu.user{*}
        indexes:
          type: array
          description: List of log index names to search; if empty, all indexes are searched
          items:
            type: string
        from:
          type: string
          description: The start of the time range for the search in ISO 8601 format or relative format (e.g., now-15m)
          example: example_value
        to:
          type: string
          description: The end of the time range for the search in ISO 8601 format or relative format (e.g., now)
          example: example_value
    LogsAggregateResponse:
      type: object
      description: Response containing aggregated log analytics results
      properties:
        data:
          type: object
          description: The aggregation response data
          properties:
            attributes:
              type: object
              description: The aggregation result attributes
              properties:
                buckets:
                  type: array
                  description: List of aggregation buckets, each representing a group-by combination
                  items:
                    $ref: '#/components/schemas/LogsAggregateBucket'
    LogsGroupBy:
      type: object
      description: A group-by configuration for aggregating log results by facet values
      required:
      - facet
      properties:
        facet:
          type: string
          description: The log attribute or tag to group results by
          example: example_value
        limit:
          type: integer
          description: The maximum number of unique facet values to return in results
          default: 10
          example: 42
        sort:
          type: object
          description: Sort configuration for group-by results
          properties:
            aggregation:
              type: string
              description: The aggregation metric to sort by
              enum:
              - count
              - cardinality
              - pc75
              - pc90
              - pc95
              - pc98
              - pc99
              - sum
              - avg
              - min
              - max
            order:
              type: string
              description: The sort direction for group-by results
              enum:
              - asc
              - desc
    APIErrorResponse:
      type: object
      description: Standard API error response returned for failed requests
      required:
      - errors
      properties:
        errors:
          type: array
          description: List of error messages describing the failure
          items:
            type: string
    LogsCompute:
      type: object
      description: A computation to perform over the filtered log set
      required:
      - aggregation
      - type
      properties:
        aggregation:
          type: string
          description: The type of aggregation to compute over log events
          enum:
          - count
          - cardinality
          - pc75
          - pc90
          - pc95
          - pc98
          - pc99
          - sum
          - avg
          - min
          - max
          example: count
        metric:
          type: string
          description: The log attribute to aggregate (required for all aggregations except count)
          example: example_value
        type:
          type: string
          description: Whether this is a total aggregation or a timeseries
          enum:
          - total
          - timeseries
          example: total
        interval:
          type: string
          description: The time interval for timeseries computations (e.g., 1m, 1h, 1d)
          example: example_value
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: DD-API-KEY
      description: Datadog API key for authenticating requests. Obtain from the Datadog organization settings under API Keys.
externalDocs:
  description: Datadog Logs API Documentation
  url: https://docs.datadoghq.com/api/latest/logs/