I’m trying to send docker logs using Alloy from remote VM to another VM where loki is running. Does alloy work with loki at all? I do not see any examples for it in repo or documentation
I tried to find examples but not finding any!
Here is the simple config i’m using
logging {
level = "debug"
format = "logfmt"
}
// Discover Docker containers
discovery.docker "containers" {
host = "unix:///var/run/docker.sock"
}
// Simple Docker log collection and forwarding
loki.source.docker "docker_logs" {
host = "unix:///var/run/docker.sock"
targets = discovery.docker.containers.targets
forward_to = [loki.write.local_loki.receiver]
}
// Write to local Loki instance
loki.write "local_loki" {
endpoint {
url = "https://vm.com/loki/api/v1/push"
}
external_labels = {
hostname = "{{ ansible_hostname }}",
source = "alloy",
}
}
I’m getting following error
ts=2025-10-20T15:12:23.551413876Z level=warn msg="error sending batch, will retry" component_path=/ component_id=loki.write.local_loki component=client host=vm.com:3100 status=-1 tenant="" error="Post \"https://vm.com:3100/loki/api/v1/push\": context deadline exceeded"
Please help!