\pset pager off
\pset tuples_only on
\pset fieldsep '\t'
SELECT 'last1h_top', count(*), coalesce(group_id,0), coalesce(model,''), coalesce(request_path,''), coalesce(error_phase,''), coalesce(error_owner,''), coalesce(status_code,0), left(coalesce(error_message,''),160)
FROM ops_error_logs
WHERE created_at >= now() - interval '1 hour'
GROUP BY 3,4,5,6,7,8,9 ORDER BY 2 DESC LIMIT 30;
SELECT 'group29_last1h', count(*), coalesce(model,''), coalesce(request_path,''), coalesce(status_code,0), left(coalesce(error_message,''),180)
FROM ops_error_logs
WHERE created_at >= now() - interval '1 hour' AND group_id=29
GROUP BY 3,4,5,6 ORDER BY 2 DESC LIMIT 20;
SELECT 'group29_accounts', count(*), status, platform FROM accounts WHERE id IN (SELECT account_id FROM account_group_bindings WHERE group_id=29) GROUP BY status,platform ORDER BY 1 DESC;
