14 lines
468 B
Bash
14 lines
468 B
Bash
|
|
#!/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'
|