Grafana Alloy
Ship logs from Grafana Alloy over OTLP HTTP with Basic auth
Use Grafana Alloy to collect log files and send them to your Logit.io Logs stack over OTLP HTTP. Alloy is Grafana's distribution of the OpenTelemetry Collector. It exports to your stack's Hosted OpenTelemetry endpoint with Basic auth. Applications can also send traces and metrics through the same exporter.
Promtail reached end of life on 2 March 2026. Grafana Agent (Static mode, Flow mode and Operator) reached end of life on 1 November 2025. Neither receives security or bug fixes. If you still run either, move to Alloy. See Migrate from Loki and Grafana Cloud for the steps.
Logs
Install integration
Before you start
- Enable Hosted OpenTelemetry on your Logs stack if the card on the stack's Endpoints page does not already show connection details.
- Copy the username and the Hosted OpenTelemetry API key from the Hosted OpenTelemetry section of the Endpoints page. The username is
{stackId}-otel. Use the Hosted OpenTelemetry API key as the password, not your OpenSearch key. - Install Alloy (opens in a new tab) on the server that holds the logs.
The destination is https://{stackId}-otel.logit.io. Replace {stackId} with your Logs stack ID. Use HTTPS on the default port 443, with no custom port. Hosted OpenTelemetry accepts OTLP over HTTP only, so use the otelcol.exporter.otlphttp component. Do not use otelcol.exporter.otlp, which sends over gRPC.
Configure Alloy
Save this as your Alloy configuration file. On Linux packages this is /etc/alloy/config.alloy. Change __path__ to the log files you want to collect.
local.file_match "app_logs" {
path_targets = [{
__path__ = "/var/log/*.log",
job = "varlogs",
}]
}
loki.source.file "app_logs" {
targets = local.file_match.app_logs.targets
forward_to = [otelcol.receiver.loki.logit.receiver]
tail_from_end = true
}
otelcol.receiver.loki "logit" {
output {
logs = [otelcol.processor.batch.logit.input]
}
}
otelcol.receiver.otlp "local_apps" {
http {
endpoint = "127.0.0.1:4318"
}
grpc {
endpoint = "127.0.0.1:4317"
}
output {
logs = [otelcol.processor.batch.logit.input]
metrics = [otelcol.processor.batch.logit.input]
traces = [otelcol.processor.batch.logit.input]
}
}
otelcol.processor.batch "logit" {
output {
logs = [otelcol.exporter.otlphttp.logit.input]
metrics = [otelcol.exporter.otlphttp.logit.input]
traces = [otelcol.exporter.otlphttp.logit.input]
}
}
otelcol.auth.basic "logit" {
username = "{stackId}-otel"
password = sys.env("LOGIT_OTEL_API_KEY")
}
otelcol.exporter.otlphttp "logit" {
client {
endpoint = "https://{stackId}-otel.logit.io"
auth = otelcol.auth.basic.logit.handler
}
}How the pipeline works:
loki.source.filereads the files andotelcol.receiver.lokiconverts each entry to an OpenTelemetry log record.tail_from_end = truestarts at the end of each file the first time Alloy sees it, so write a new log line after Alloy starts. Remove it to read existing content too.otelcol.receiver.otlpis optional. It lets local applications send OTLP logs, traces and metrics to Alloy on loopback ports. Delete the whole block, and themetricsandtraceslines in the batch processor'soutput, if you only collect files.otelcol.auth.basicreads the API key from theLOGIT_OTEL_API_KEYenvironment variable, so the key stays out of the file.- Traces and metrics are accepted, but they are stored only if your stack has the APM or Metrics add-on. Logs need no add-on.
Set the API key and start Alloy
Set LOGIT_OTEL_API_KEY in the environment of the Alloy service. For the Linux packages, add it to the service environment file, /etc/default/alloy on Debian and Ubuntu or /etc/sysconfig/alloy on RHEL.
LOGIT_OTEL_API_KEY="<your-hosted-otel-api-key>"Check the file, then restart the service. The service needs read access to each log file.
alloy validate /etc/alloy/config.alloy
sudo systemctl restart alloyalloy validate checks the syntax and component wiring. It makes no network connections.
Launch OpenSearch Dashboards to view your data
Launch OpenSearch DashboardsHow to diagnose no data in your stack
If you don't see data appearing in your stack after following this integration, take a look at the troubleshooting guide for steps to diagnose and resolve the problem or contact our support team and we'll be happy to assist.
Troubleshooting
| Symptom | What to check |
|---|---|
| HTTP 401 in the Alloy logs | Is the username exactly {stackId}-otel? Is the password the Hosted OpenTelemetry API key from the Endpoints page? Did you rotate the key and not update LOGIT_OTEL_API_KEY? |
| Connection or TLS errors | Is the endpoint https://{stackId}-otel.logit.io with no port? Are you using otelcol.exporter.otlphttp and not the gRPC exporter? |
| Logs arrive but traces or metrics do not | Does the stack have the APM or Metrics add-on? Hosted OpenTelemetry accepts these signals but stores them only with the add-on. |
| Old log lines are missing | tail_from_end = true skips content that was already in the file when Alloy first read it. |
Related guides
- Hosted OpenTelemetry for the endpoint, credentials and limits.
- Migrate from Loki and Grafana Cloud to convert a Promtail or Grafana Agent configuration.
- OpenTelemetry Collector if you prefer the upstream Collector.