I had some queries that were timing out in a web app, which were identified by a log pattern where the request had a log with request_started
but was missing a log with request_finished
.
I wanted to find queries that matched that pattern and as far as I could tell, datadog didn’t support an aggregate query across request ids like this. So I exported the data to a CSV and queried it directly.
service:odyn-prod @event:request_*
.sqlite-utils insert data.db data data.csv --csv
datasette data.db
with og as (
select
rowid,
Date,
Host,
Service,
[@log.level],
[@code],
[@event],
Message,
json_extract(Message, '$.request_id') as request_id,
json_extract(Message, '$.request') as request
from
data
)
select
request_id,
count(*) as c,
group_concat([@event], ' | ') as m,
group_concat(request, ' | ') as request
from
og
group by
request_id
order by
c
If you’re running datasette locally with the steps above, you can visit this link.