Skip to content

Commit

Permalink
chore: write log to greptime by loki protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
paomian committed Dec 9, 2024
1 parent 112ca93 commit de8105d
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 @@ -88,7 +102,7 @@ otelcol.processor.attributes "enrichment" {
}

output {
logs = [otelcol.exporter.otlphttp.greptimedb_logs.input]
logs = [otelcol.exporter.otlphttp.greptimedb_logs.input, loki.write.greptime_loki.receiver]
}
}

Expand Down
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 de8105d

Please sign in to comment.