Skip to content

Commit

Permalink
chore: add otlp logs demo for grafana alloy (#61)
Browse files Browse the repository at this point in the history
* chore: add otlp logs and rename vector ingestion readme

* Apply suggestions from code review

Co-authored-by: Ning Sun <[email protected]>

---------

Co-authored-by: Ning Sun <[email protected]>
  • Loading branch information
paomian and sunng87 authored Nov 18, 2024
1 parent 07d91f2 commit 61718db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions grafana-alloy/config.alloy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,32 @@ otelcol.exporter.otlphttp "greptimedb" {
}
}

otelcol.exporter.otlphttp "greptimedb_logs" {
client {
endpoint = "${GREPTIME_SCHEME:=http}://${GREPTIME_HOST:=greptimedb}:${GREPTIME_PORT:=4000}/v1/otlp/"
headers = {
"X-Greptime-DB-Name" = "${GREPTIME_DB:=public}",
"x-greptime-log-table-name" = "demo_logs",
"x-greptime-log-extract-keys" = "filename",
}
auth = otelcol.auth.basic.credentials.handler
}
}

otelcol.auth.basic "credentials" {
username = "${GREPTIME_USERNAME}"
password = "${GREPTIME_PASSWORD}"
}

loki.source.file "greptime" {
targets = [
{__path__ = "/tmp/foo.txt"},
]
forward_to = [otelcol.receiver.loki.greptime.receiver]
}

otelcol.receiver.loki "greptime" {
output {
logs = [otelcol.exporter.otlphttp.greptimedb_logs.input]
}
}
3 changes: 2 additions & 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-20241007
image: docker.io/greptime/greptimedb:v0.10.0-nightly-20241104
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 Expand Up @@ -44,6 +44,7 @@ services:
- demo-network
volumes:
- config:/etc/alloy
- ./foo.txt:/tmp/foo.txt
depends_on:
envsubst:
condition: service_completed_successfully
Expand Down

0 comments on commit 61718db

Please sign in to comment.