Skip to content

Commit 22d417d

Browse files
committed
Add reporting view reporthosts
1 parent facd7a8 commit 22d417d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

log.sql

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ create view report24h as
8888
where i.t > now() - interval '1 days'
8989
group by 2 order by count desc;
9090

91+
create or replace view reporthosts as
92+
SELECT count(1) AS count,
93+
substring(firstline(e.msg),1,80) as firstline,
94+
array_agg(DISTINCT i.hostname) AS hosts
95+
FROM error e
96+
JOIN instance i ON i.id = e.id
97+
WHERE e.t > (now() - '24:00:00'::interval)
98+
GROUP BY 2
99+
ORDER BY (count(1));
100+
91101
create view instance_activity as
92102
select i.hostname, i.target, max(e.t)
93103
from instance i join error e on (i.id = e.id)

0 commit comments

Comments
 (0)