Skip to content

Commit

Permalink
chore: write log to greptime by loki protocol (#65)
Browse files Browse the repository at this point in the history
* chore: write log to greptime by loki protocol

* chore: change loki receiver location
  • Loading branch information
paomian authored Dec 9, 2024
1 parent 112ca93 commit a28928f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion grafana-alloy/config.alloy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ otelcol.exporter.otlphttp "greptimedb_logs" {
}
}

loki.write "greptime_loki" {
endpoint {
url = "${GREPTIME_SCHEME:=http}://${GREPTIME_HOST:=greptimedb}:${GREPTIME_PORT:=4000}/v1/loki/api/v1/push"
headers = {
"X-Greptime-DB-Name" = "${GREPTIME_DB:=public}",
"X-Greptime-Log-Table-Name" = "${GREPTIME_LOG_TABLE_NAME:=loki_demo_logs}",
}
}
external_labels = {
"job" = "greptime",
"from" = "alloy",
}
}

otelcol.auth.basic "credentials" {
username = "${GREPTIME_USERNAME}"
password = "${GREPTIME_PASSWORD}"
Expand All @@ -101,5 +115,5 @@ otelcol.receiver.loki "greptime" {
logging {
level = "info"
format = "json"
write_to = [otelcol.receiver.loki.greptime.receiver]
write_to = [otelcol.receiver.loki.greptime.receiver, loki.write.greptime_loki.receiver]
}
2 changes: 1 addition & 1 deletion grafana-alloy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
init: true

greptimedb:
image: docker.io/greptime/greptimedb:v0.10.0-nightly-20241104
image: docker.io/greptime/greptimedb:v0.11.0-nightly-20241125
command: standalone start --http-addr=0.0.0.0:4000 --rpc-addr=0.0.0.0:4001 --mysql-addr=0.0.0.0:4002 --postgres-addr 0.0.0.0:4003
ports:
- 4000:4000
Expand Down

0 comments on commit a28928f

Please sign in to comment.