Skip to content

Commit ca23c25

Browse files
Add logs-loki target
Co-authored-by: Tomas Tomecek <[email protected]>
1 parent 790efda commit ca23c25

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
IMAGE_NAME ?= beeai-agent
22
COMPOSE_FILE ?= compose.yaml
33
DRY_RUN ?= false
4+
LOKI_URL ?= http://loki.tft.osci.redhat.com/
5+
LOKI_SINCE ?= 24h
6+
LOKI_LIMIT ?= 3000
7+
LOKI_POD ?= mcp-gateway
48

59
COMPOSE ?= $(shell command -v podman >/dev/null 2>&1 && echo "podman compose" || echo "docker-compose")
610
COMPOSE_AGENTS=$(COMPOSE) -f $(COMPOSE_FILE) --profile=agents
@@ -132,6 +136,31 @@ logs-rebase:
132136
logs-jira-issue-fetcher:
133137
$(COMPOSE) -f $(COMPOSE_FILE) --profile manual logs -f jira-issue-fetcher
134138

139+
140+
# Loki logcli targets
141+
# https://grafana.com/docs/loki/latest/setup/install/local/
142+
# add their RPM repos and `dnf install logcli`
143+
LOKI_CMD = logcli --output-timestamp-format=unixdate --addr=$(LOKI_URL) query --since=$(LOKI_SINCE) --limit=$(LOKI_LIMIT) -o raw
144+
LOKI_FILTER = '{kubernetes_container_name="$(1)",kubernetes_namespace_name="jotnar-prod"} | json | line_format "{{._timestamp}} {{.kubernetes_pod_name}} {{.message}}"'
145+
146+
.PHONY: logs-loki-help
147+
logs-loki-help:
148+
@echo "Available pod names:"
149+
@echo " - triage-agent"
150+
@echo " - backport-agent-c9s"
151+
@echo " - backport-agent-c10s"
152+
@echo " - rebase-agent-c9s"
153+
@echo " - rebase-agent-c10s"
154+
@echo " - supervisor-collector"
155+
@echo " - supervisor-processor"
156+
@echo " - mcp-gateway"
157+
@echo " - valkey"
158+
@echo "Usage example: LOKI_SINCE=24h LOKI_POD=<pod-name> make logs-loki"
159+
160+
.PHONY: logs-loki
161+
logs-loki:
162+
$(LOKI_CMD) $(call LOKI_FILTER,$(LOKI_POD))
163+
135164
.PHONY: trigger-pipeline
136165
trigger-pipeline:
137166
@if [ -z "$(JIRA_ISSUE)" ]; then \

0 commit comments

Comments
 (0)