Sending logs and traces to Grafana cloud from your Rust application

Sending logs and traces from a Rust app to Grafana cloud Run the Grafana agent Put the Grafana agent config in grafana-agent/agent/agent.yaml. server: log_level: debug logs: configs: - name: default positions: filename: /tmp/positions.yaml scrape_configs: - job_name: varlogs static_configs: - targets: [localhost] labels: job: varlogs app: rust-grafana-metrics-logs-traces __path__: /var/log/app/*log clients: - url: <grafana-cloud-loki-url> traces: configs: - name: default receivers: otlp: protocols: grpc: remote_write: - endpoint: tempo-us-central1.grafana.net:443 insecure: false # only add this if TLS is not required basic_auth: username: <grafana-cloud-tempo-username> password: <grafana-cloud-tempo-password> batch: timeout: 5s send_batch_size: 100 Run the Grafana agent docker run \ -v $PWD/grafana-agent/data:/etc/agent/data \ -v $PWD/grafana-agent/agent.yaml:/etc/agent/agent.yaml \ -v $PWD/log:/var/log/app \ -p 4317:4317 \ grafana/agent:v0.35.0 Dependencies being used Replace axum with whatever dependency you are using. The ones you’ll use no matter the framework are: ...

July 22, 2023 · 3 min · poorlydefinedbehaviour