video-iac/scripts/loki-query.sh

14 lines
468 B
Bash
Raw Permalink Normal View History

2025-12-13 20:53:22 +00:00
#!/bin/bash
# Query Loki for recent logs of a specific pod regex
# Usage: ./scripts/loki-query.sh [pod_regex]
# Example: ./scripts/loki-query.sh "webrtc-be-.*"
POD_REGEX="${1:-webrtc-be-.*}"
echo "Querying Loki for pod regex: ${POD_REGEX}"
echo "Checking labels (namespace, cluster, etc)..."
curl -G -s "http://localhost:3101/loki/api/v1/query_range" \
--data-urlencode "query={pod=~\"${POD_REGEX}\"}" \
--data-urlencode "limit=1" | jq '.data.result[0].stream'