https://signoz.io logo
#general
Title
# general
ł

Łukasz Herman

10/03/2022, 8:54 AM
Can I create dashboard based on logs? Like number of specific logs per second.
a

Ankit Nayan

10/03/2022, 10:20 AM
yes..you can..using clickhouse queries in the dashboards @nitya-signoz can you share a sample query on logs for reference?
ł

Łukasz Herman

11/17/2022, 11:00 AM
@nitya-signoz Hi, could you show some sample query to visualise logs data? I'm not familiar with this query language, I need something to start from.
n

nitya-signoz

11/17/2022, 11:23 AM
@Łukasz Herman here are three examples
Copy code
Count of logs over time
select toStartOfInterval(fromUnixTimestamp64Nano(timestamp), INTERVAL 1 MINUTE) AS interval, toFloat64(count()) as value from signoz_logs.logs  where timestamp > toUnixTimestamp64Nano(now64() - INTERVAL 30 MINUTE)  group by interval order by interval asc;

Count of error logs over time
select toStartOfInterval(fromUnixTimestamp64Nano(timestamp), INTERVAL 1 MINUTE) AS interval, toFloat64(count()) as value from signoz_logs.logs  where timestamp > toUnixTimestamp64Nano(now64() - INTERVAL 30 MINUTE) AND stream='stderr' group by interval order by interval asc;

Quantile
select toStartOfInterval(fromUnixTimestamp64Nano(timestamp), INTERVAL 1 MINUTE) AS interval, quantile(0.9)(bytes) as value from signoz_logs.logs  where timestamp > toUnixTimestamp64Nano(now64() - INTERVAL 30 MINUTE)  group by interval order by interval asc;
Please note that things in the where clause are interesting fields. For more aggregate functions refer to https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/
2 Views