Learn by Directing AI
All materials

alloy-config.yaml

yamlalloy-config.yaml
discovery.docker "containers" {
  host = "unix:///var/run/docker.sock"
}

loki.source.docker "default" {
  host       = "unix:///var/run/docker.sock"
  targets    = discovery.docker.containers.targets
  forward_to = [loki.process.filter.receiver]
}

loki.process "filter" {
  stage.docker {}

  stage.label_drop {
    values = ["filename"]
  }

  stage.static_labels {
    values = {
      env = "cooperative",
    }
  }

  forward_to = [loki.write.local.receiver]
}

loki.write "local" {
  endpoint {
    url = "http://loki:3100/loki/api/v1/push"
  }
}