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 - Open Source Datadog Alternative
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.

Search Logs

This section provides example of how to search logs using the SigNoz Logs API. The example demonstrates querying logs with specific attributes and using pagination to navigate through the results.

Example Query

The following example searches for logs where deployment_name=hotrod, method=get, and severity_text=info. Here, deployment_name is a resource attribute, method is a tag attribute, and severity_text is a top-level field. You can choose the start and end timestamp according to your use case.

Sample Payload

This is the JSON payload for the example query described above for Searching Logs.

{
    "start": 1700733979000,
    "end": 1700737579000,
    "requestType": "raw",
    "variables": {},
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "filter": {
                        "expression": "deployment_name = 'hotrod' AND method = 'get' AND severity_text = 'info'"
                    },
                    "order": [
                        {
                            "key": {
                                "name": "timestamp"
                            },
                            "direction": "desc"
                        },
                        {
                            "key": {
                                "name": "id"
                            },
                            "direction": "desc"
                        }
                    ],
                    "offset": 0,
                    "limit": 100
                }
            }
        ]
    }
}

Pagination in Log Search

Pagination is crucial for efficiently navigating through large sets of log data. The SigNoz Logs API supports pagination, allowing you to retrieve logs in manageable batches. Below are examples demonstrating how to implement pagination in your log search queries.

Ordering by Timestamp

If we are ordering by timestamp, then we will use offset and limit for pagination. We will also include id in the orderby with the same order as timestamp.

Fetching the Latest 10 logs

To retrieve the most recent 10 logs, you set the limit to 10, offset to 0 and order the results by timestamp and id in descending order. This ensures that you get the latest logs first.

{
    "start": 1700734490000,
    "end": 1700738090000,
    "requestType": "raw",
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "filter": {
                        "expression": ""
                    },
                    "order": [
                        {
                            "key": {
                                "name": "timestamp"
                            },
                            "direction": "desc"
                        },
                        {
                            "key": {
                                "name": "id"
                            },
                            "direction": "desc"
                        }
                    ],
                    "offset": 0,
                    "limit": 10
                }
            }
        ]
    }
}

Fetching the Previous 10 logs

To fetch the 10 logs preceding the most recent batch, add offset as 10 to skip the first 10 logs.

{
    "start": 1700734490000,
    "end": 1700738090000,
    "requestType": "raw",
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "filter": {
                        "expression": ""
                    },
                    "order": [
                        {
                            "key": {
                                "name": "timestamp"
                            },
                            "direction": "desc"
                        },
                        {
                            "key": {
                                "name": "id"
                            },
                            "direction": "desc"
                        }
                    ],
                    "offset": 10,
                    "limit": 10
                }
            }
        ]
    }
}

Ordering by Any Other Key

In addition to fetching logs based on timestamps, the SigNoz Logs API allows you to paginate through logs using other keys. This method can be faster or slower depending on the key used.

Fetching the Latest 10 logs

To fetch the latest 10 logs based on a specific key (e.g., response_time), set the limit to 10 and order by that key in descending order. This retrieves the most recent logs according to the specified key.

{
    "start": 1700734490000,
    "end": 1700738090000,
    "requestType": "raw",
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "filter": {
                        "expression": ""
                    },
                    "order": [
                        {
                            "key": {
                                "name": "response_time"
                            },
                            "direction": "desc"
                        }
                    ],
                    "offset": 0,
                    "limit": 10
                }
            }
        ]
    }
}

Fetching the Previous 10 logs

To fetch the previous 10 logs, you can use the offset parameter. For example, if you have already fetched the first 10 logs, set offset to 10 to retrieve the next 10 logs based on the specified key.

{
    "start": 1700734490000,
    "end": 1700738090000,
    "requestType": "raw",
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "logs",
                    "filter": {
                        "expression": ""
                    },
                    "order": [
                        {
                            "key": {
                                "name": "response_time"
                            },
                            "direction": "desc"
                        }
                    ],
                    "offset": 10,
                    "limit": 10
                }
            }
        ]
    }
}

Last updated: May 4, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.

Prev
Payload Model
Next
Aggregate Logs
On this page
Example Query
Sample Payload
Pagination in Log Search
Ordering by Timestamp
Ordering by Any Other Key

Is this page helpful?

Your response helps us improve this page.