From ed4107a7e6271e2f780e963e067a72b7428a8903 Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Mon, 23 Oct 2023 16:39:36 -0500 Subject: [PATCH] contrib: add some helper scripts for analyzing logs I always end up re-writing filters like these, so here's some premade versions. Signed-off-by: Hank Donnay --- contrib/logs/follow-request | 4 ++++ contrib/logs/regroup-errors | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100755 contrib/logs/follow-request create mode 100755 contrib/logs/regroup-errors diff --git a/contrib/logs/follow-request b/contrib/logs/follow-request new file mode 100755 index 0000000000..9073c04ac0 --- /dev/null +++ b/contrib/logs/follow-request @@ -0,0 +1,4 @@ +#!/bin/sh +id=${1?Missing \"id\" argument} +shift 1 +exec jq -c -r -n --arg id "${id}" '[ inputs | select(.request_id == $id) ] | sort_by(.time) | .[]' -- "$@" diff --git a/contrib/logs/regroup-errors b/contrib/logs/regroup-errors new file mode 100755 index 0000000000..96918eaa57 --- /dev/null +++ b/contrib/logs/regroup-errors @@ -0,0 +1,9 @@ +#!/bin/sh -- +# \ +exec jq -c -r -n -f "${0}" -- "$@" + +[ inputs ] | +( [ .[] | select(.status >= 500) | .request_id ] | unique | .[] ) as $id | +[ .[] | select(.request_id == $id) ] | + sort_by(.time) | + .[]