{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/datadog/refs/heads/main/json-structure/datadog-logs-logs-group-by-structure.json",
  "name": "LogsGroupBy",
  "description": "A group-by configuration for aggregating log results by facet values",
  "type": "object",
  "properties": {
    "facet": {
      "type": "string",
      "description": "The log attribute or tag to group results by",
      "example": "example_value"
    },
    "limit": {
      "type": "int32",
      "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"
          ]
        }
      }
    }
  },
  "required": [
    "facet"
  ]
}