wip: better query for raw preview #1

Open
opened 2023-11-15 12:45:21 +03:00 by Neur0toxine · 0 comments
Owner
SELECT 
  visitParamExtractString(message, 'time') as time,
  visitParamExtractString(message, 'level') as level,
  visitParamExtractString(message, 'connection') as connection,
  visitParamExtractString(message, 'account') as account,
  visitParamExtractString(message, 'handler') as handler,
  visitParamExtractString(message, 'msg') as msg,
  JSONExtractRaw(message, arrayFilter((v) -> v NOT IN ('time', 'level', 'connection', 'account', 'handler', 'msg'), JSONExtractKeys(message))) as raw,
  arrayFilter((v) -> v NOT IN ('time', 'level', 'connection', 'account', 'handler', 'msg'), JSONExtractKeys(message)) as raw2
FROM "default"."log_docker_raw"
WHERE   ( logdatetime  >= $__fromTime AND logdatetime <= $__toTime )
  AND IF('Any' IN (${priority}), 1 = 1, level IN (${priority}))
  AND ( program = ${program:singlequote} )
  AND ( message LIKE '%$filter1%' )
  AND ( message LIKE '%$filter2%' )
  AND ( message LIKE '%$filter3%' )
  AND ( msg <> '' )
ORDER BY logdatetime DESC LIMIT 5000
```sql SELECT visitParamExtractString(message, 'time') as time, visitParamExtractString(message, 'level') as level, visitParamExtractString(message, 'connection') as connection, visitParamExtractString(message, 'account') as account, visitParamExtractString(message, 'handler') as handler, visitParamExtractString(message, 'msg') as msg, JSONExtractRaw(message, arrayFilter((v) -> v NOT IN ('time', 'level', 'connection', 'account', 'handler', 'msg'), JSONExtractKeys(message))) as raw, arrayFilter((v) -> v NOT IN ('time', 'level', 'connection', 'account', 'handler', 'msg'), JSONExtractKeys(message)) as raw2 FROM "default"."log_docker_raw" WHERE ( logdatetime >= $__fromTime AND logdatetime <= $__toTime ) AND IF('Any' IN (${priority}), 1 = 1, level IN (${priority})) AND ( program = ${program:singlequote} ) AND ( message LIKE '%$filter1%' ) AND ( message LIKE '%$filter2%' ) AND ( message LIKE '%$filter3%' ) AND ( msg <> '' ) ORDER BY logdatetime DESC LIMIT 5000 ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Neur0toxine/docker-logs-grafana-clickhouse#1
No description provided.