Exclude pgbouncer logs with loki command

This commit is contained in:
Daniel Berteaud 2024-03-08 09:26:15 +01:00
parent 4a214e5a5a
commit 917f5bdd75
2 changed files with 3 additions and 1 deletions

2
ctctl
View File

@ -773,7 +773,7 @@ ctctl_loki_logs(){
${LOGCLI_CMD} $@
else
# Exclude connect-proxy logs as it's often not wanted
SELECTOR='{job=~"'$(ctctl_ls_jobs | sed -zE 's/\n/|/g' | sed -E 's/\s+//' | sed -E 's/\|$//')'", task!~"connect-proxy-.+|tls-proxy|metrics-proxy"}'
SELECTOR='{job=~"'$(ctctl_ls_jobs | sed -zE 's/\n/|/g' | sed -E 's/\s+//' | sed -E 's/\|$//')'", task!~"'${LOKI_IGNORE_TASKS:-connect-proxy-.+|tls-proxy|metrics-proxy|pgbouncer}'"}'
echo "Running ${LOGCLI_CMD} $@ ${SELECTOR}"
${LOGCLI_CMD} $@ "${SELECTOR}"
fi

View File

@ -23,6 +23,8 @@
# LOKI_PASSWORD=S3cr3t.
# Alternatively, you can use a command to fetch the password on demande
# LOKI_PWD_CMD="vault read -field pwd kv/admin/loki"
# Regex of tasks to ignore with ctctl loki
# LOKI_IGNORE_TASKS="connect-proxy-.+|tls-proxy|metrics-proxy|pgbouncer"
# You can render a bundle in the example directory of the bundle itself
# using only the default variables