Create Logs URL for Explorer page

This section explains how to generate a URL for the SigNoz Explorer page. This URL allows users to directly access the Explorer page with predefined filters and a custom time range, facilitating quick and efficient log analysis.

Params for URL

The generation of the final URL involves appending certain parameters to the base URL of the Explorer page. The base URL route for explorer page looks like:

/logs-explorer?

The parameters includes:

NAMEDESCRIPTIONURI encoded
panelTypes"list"/"graph"/"table"once
compositeQueryIt's a JSON structure consisting of builderQueriestwice
startTimeTimestamp start in msno
endTimeTimestamp end in msno

These parameters have to be encoded before being appended to the base URL. The URI encoded column describes the number of times the parameter has to be URI encoded. noindicates that these parameters don't have to be encoded.

You can use this tool to encode your parameters.

Example of Composite Query

compositeQuery is one of the parameter that is used to create the final URL. Here's an example composite query that is configured to fetch logs from a specified data source where the container_name equals "hotrod":

{
  "queryType": "builder",
  "builder": {
    "queryData": [
      {
        "dataSource": "logs",
        "queryName": "A",
        "aggregateOperator": "noop",
        "aggregateAttribute": {
        },
        "filters": {
          "items": [
            {
              "id": "81c40cb5",
              "key": {
                "key": "container_name",
                "dataType": "string",
                "type": "tag",
                "isColumn": false,
                "isJSON": false,
                "id": "container_name--string--tag--false"
              },
              "op": "=",
              "value": "hotrod"
            }
          ],
          "op": "AND"
        },
        "expression": "A",
        "disabled": false,
        "having": [],
        "stepInterval": 240,
        "limit": null,
        "orderBy": [
          {
            "columnName": "timestamp",
            "order": "desc"
          }
        ],
        "groupBy": [],
        "legend": "",
        "reduceTo": "sum"
      }
    ],
    "queryFormulas": []
  },
  "id": "af9df71b-b6eb-48e5-b889-f4d0946c6eaa"
}

In the above query, the builderQueries map is structured as an array within the queryData field to align with the frontend's state management format.

Generating the URL

Once you have all the parameters defined and encoded as mentioned in the Param for URL section, we can append them to the base URL of the SigNoz Explorer page.

This creates a direct link that pre-loads the Explorer page with the specified query parameters.

Sample Final URL

After appending the encoded parameters to the base URL, this is how a complete URL would look like:

https://[Your-SigNoz-Domain]/logs-explorer?startTime=[start-time]&endTime=[end-time]&panelTypes=[encoded-panelTypes]&compositeQuery=[encoded-compositeQuery]

The complete URL when visited, will open the Explorer page with the log query and time range already set up as per the parameters. This feature is particularly useful for bookmarking specific log views or sharing them with others.

Was this page helpful?