Skip to content

Instantly share code, notes, and snippets.

@alastaircoote
Last active September 15, 2016 16:58
Show Gist options
  • Save alastaircoote/36b2eaa5cd12c06b4ade8354830c3a63 to your computer and use it in GitHub Desktop.
Save alastaircoote/36b2eaa5cd12c06b4ade8354830c3a63 to your computer and use it in GitHub Desktop.
View schema for grouped log entries
SELECT
min(log_entries."time") AS "time",
max(log_entries.level) AS level,
jsonb_merge(log_entries.data) AS data,
json_agg(log_entries.msg) AS msg,
log_entries.req_id
FROM log_entries
GROUP BY log_entries.req_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment