Skip to main content

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,
"step": 60,
"variables": {},
"compositeQuery": {
"queryType": "builder",
"panelType": "table",
"builderQueries": {
"A": {
"dataSource": "logs",
"queryName": "A",
"aggregateOperator": "count_distinct",
"aggregateAttribute": {
"key": "component",
"dataType": "string",
"type": "tag",
"isColumn": false
},
"filters": {
"items": [],
"op": "AND"
},
"expression": "A",
"disabled": false,
"stepInterval": 60,
"orderBy": [
{
"columnName": "timestamp",
"order": "desc"
}
],
"groupBy": [
{
"key": "container_id",
"dataType": "string",
"type": "tag",
"isColumn": true,
"isJSON": false
}
],
"offset": 0
}
}
}
}