Logs API Reference :: Kloudfuse Docs
Logs API Reference
FuseQL queries
FuseQL queries support the full FuseQL operator set including aggregation, parsing, string manipulation, and IP operators. Use these endpoints when you want to run FuseQL pipelines — parse, where, count, avg, timeslice, lookup, and so on — against your log data.
getLogMetricsResultWithKfuseQl
Returns an aggregated metrics result for the specified time range using the FuseQL engine. Use this for any FuseQL query that groups, aggregates, or uses timeslice — the full FuseQL operator set is available.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | Yes | FuseQL query string. |
startTs |
Time | Yes | Start of the time range (RFC 3339 timestamp). |
endTs |
Time | Yes | End of the time range (RFC 3339 timestamp). |
timeoutSecs |
int | No | Query timeout in seconds. Default: 60. |
options |
string | No | Comma-separated k=v pairs. Not implemented — do not use. |
Response fields (FuseQLQueryResult):
| Field | Description |
|---|---|
ColumnHeaders |
List of column names in the result table. |
AggrValues |
List of aggregation column names (e.g. _count, _sum). |
GroupKeys |
List of group-by column names. |
TimeKey |
The time bucket column name (set when using timeslice). |
TableResult |
Rows returned from the FuseQL query; each row is an ordered array matching ColumnHeaders. |
UrlValues |
List of URL column names. |
Count all logs in a one-hour window
curl -H "Authorization: Bearer <sa-token>" \
-H "Content-Type: application/json" \
-X POST "https://<your-instance>/query" \
-d '{\n "query": "{ getLogMetricsResultWithKfuseQl(query: \"* | timeslice 5m | count by (_timeslice)\", startTs: \"2026-06-27T03:56:36Z\", endTs: \"2026-06-27T04:56:36Z\") { AggrValues ColumnHeaders GroupKeys TimeKey TableResult UrlValues } }"\n }'
Count error logs grouped by source
curl -H "Authorization: Bearer <sa-token>" \
-H "Content-Type: application/json" \
-X POST "https://<your-instance>/query" \
-d '{\n "query": "{ getLogMetricsResultWithKfuseQl(query: \"level=\\\"error\\\" | count by (source)\", startTs: \"2026-06-27T03:56:36Z\", endTs: \"2026-06-27T04:56:36Z\") { ColumnHeaders TableResult } }"\n }'
getLogsWithFuseQlStream
Returns raw log rows for the specified time range using the FuseQL engine. Results are paginated: the response includes a Cursor value to pass in subsequent requests. When Cursor is an empty string, there are no more results.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | Yes | FuseQL query string. Window and aggregation operators are not supported. |
startTs |
Time | Yes | Start of the time range (RFC 3339 timestamp). |
endTs |
Time | Yes | End of the time range (RFC 3339 timestamp). |
cursor |
string | No | Pagination cursor from the previous response. Pass null for the first request. |
timeoutSecs |
int | No | Query timeout in seconds. Default: 60. |
options |
string | No | Comma-separated k=v pairs. Not implemented — do not use. |
Fetch the first page of logs from a source
curl -H "Authorization: Bearer <sa-token>" \
-H "Content-Type: application/json" \
-X POST "https://<your-instance>/query" \
-d '{\n "query": "subscription { getLogsWithFuseQlStream(query: \"source=\\\"grafana\\\" | limit 2\", startTs: \"2026-06-27T03:56:36Z\", endTs: \"2026-06-27T04:56:36Z\", cursor: null) { ColumnHeaders TableResult Cursor } }"\n }'
LogQL queries
The following APIs use the LogQL query engine for log retrieval and facet analysis. Use these when you need to filter logs using LogQL syntax or retrieve facet and label values.
getFacetValueCountsStream
Get count facet values for the specified time range, with filter support.
Syntax
subscription { (1)
getFacetValueCountsStream(
facetName: String! (2)
dataType: String (3)
logQuery: LogQuery (4)
timestamp: Time (5)
durationSecs: Int (6)
limit: Int (7)
timeoutSecs: Int (8)
options: String (9)
): ValueCountList! (10)
}
getLabelValuesStream
Get label values for the specified label name.
Syntax
subscription { (1)
getLabelValuesStream(
labelName: String! (2)
logQuery: LogQuery (3)
timestamp: Time (4)
durationSecs: Int (5)
includeCount: Boolean (6)
limit: Int (7)
contains: String (8)
timeoutSecs: Int (9)
options: String (10)
): ValueCountList! (11)
}
Error handling
GraphQL errors are returned with HTTP 200 in an errors array alongside a null data value:
{
"errors": [\
{\
"message": "syntax error",\
"path": ["getLogMetricsResultWithKfuseQl"]\
}\
],
"data": {
"getLogMetricsResultWithKfuseQl": null
}
}
Common error causes:
| Message | Likely cause |
|---|---|
syntax error |
Invalid FuseQL query string — check operator names and quoting. |
access control check failed |
The Service Account token lacks permission for the requested resource. |
context deadline exceeded |
Query exceeded timeoutSecs. Narrow the time range or simplify the query. |