Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 67e6a90

Browse files
authored
Merge pull request #21 from tinybirdco/add-logs-endpoint2
update logs endpoint
2 parents baeb781 + 76ec35a commit 67e6a90

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

mcp-analytics/pipes/api_logs.pipe

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@ NODE logs
44
SQL >
55
%
66
SELECT *
7-
FROM mcp_monitoring
8-
WHERE
9-
datetime between parseDateTimeBestEffort({{DateTime(from_date)}}) and parseDateTimeBestEffort({{DateTime(to_date)}})
10-
ORDER BY datetime desc
11-
LIMIT {{Int32(page_size, 100)}}
12-
OFFSET {{Int32(page, 0) * Int32(page_size, 100)}}
7+
FROM mcp_monitoring
8+
WHERE 1
9+
{% if defined(date_from) and defined(date_to) %}
10+
and datetime between parseDateTimeBestEffort({{String(date_from)}}) and parseDateTimeBestEffort({{String(date_to)}})
11+
{% end %}
12+
{% if defined(app_name) %}
13+
and app_name in {{Array(app_name)}}
14+
{% end %}
15+
{% if defined(version) %}
16+
and version in splitByChar(',', replaceRegexpAll({{String(version)}}, '[{}]', ''))
17+
{% end %}
18+
{% if defined(tool) %}
19+
and version in splitByChar(',', replaceRegexpAll({{String(tool)}}, '[{}]', ''))
20+
{% end %}
21+
{% if defined(log) %}
22+
and message like concat('%', {{String(log)}}, '%')
23+
{% end %}
24+
ORDER BY datetime desc
25+
LIMIT {{Int32(page_size, 10000)}}
26+
OFFSET {{Int32(page, 0) * Int32(page_size, 10000)}}

0 commit comments

Comments
 (0)