SigNoz
Docs
PricingCustomers
Get Started - Free
Docs
IntroductionContributingMigrate from DatadogSigNoz API
OpenTelemetry
What is OpenTelemetryOpenTelemetry Collector GuideOpenTelemetry Demo
Community
Support
Slack
X
Launch Week
Changelog
Dashboard Templates
DevOps Wordle
Newsletter
KubeCon, Atlanta 2025
More
SigNoz vs DatadogSigNoz vs New RelicSigNoz vs GrafanaSigNoz vs Dynatrace
Careers
AboutTermsPrivacySecurity & Compliance
SigNoz Logo
SigNoz
All systems operational
HIPAASOC-2
SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

Aggregate Logs

This section demonstrates how to perform aggregation operations on log data using the SigNoz Logs API. The example provided focuses on counting distinct components and grouping the results by container_id

Example of Aggregating Logs

The following example illustrates how to count distinct component values and group them by container_id. This can be useful for understanding the distribution of different components across various containers.

Sample Payload

This is the JSON payload for the example described above for Aggregating Logs

{
    "start": 1700734490000,
    "end": 1700738090000,
    "requestType": "scalar",
    "variables": {},
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "aggregations": [
                        {
                            "expression": "count_distinct(component)",
                            "alias": "distinct_components"
                        }
                    ],
                    "groupBy": [
                        {
                            "name": "container_id",
                        }
                    ],
                    "order": [
                        {
                            "key": {
                                "name": "distinct_components"
                            },
                            "direction": "desc"
                        }
                    ],
                    "disabled": false
                }
            }
        ]
    }
}

Last updated: May 4, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.

Prev
Search Logs
Next
Logs URL for Explorer
On this page
Example of Aggregating Logs
Sample Payload

Is this page helpful?

Your response helps us improve this page.