Grfana alloy config

I am trying to set up grafana alloy to send oracle logs to my loki server. My loki server is connected to Grafana so i can view the logs. the Loki server is just an on-prem server not in a docker or Kubernetes. my loki is running on rocky linux and seems to be working properly as i can send windows logs to it and it works fine.

The error i am getting in my alloy journalctl is listed below:

Apr 23 20:33:23 alloy[605148]: ts=2025-04-24T00:33:23.027630019Z level=error msg=“final error sending batch” component_path=/ component_id=loki.write.grafana_loki3 com>

I have no labels configures and not sure if i need any or really how i can do that. Sorry i’m new to alloy. My alloy config looks like this:

logging {
  level = "debug"
  format = "logfmt"
}

livedebugging {
  enabled = true
}

local.file_match "local_files" {
     path_targets = [{__path__ = "/u01/app/oracle/diag/rdbms/ftxe02/FTXE02/trace/alert_FTXE02.log"}]

//     sync_period = "5s"
}

local.file_match "local_files2" {
     path_targets = [{__path__ = "/u01/app/oracle/diag/rdbms/ftae02/FTAE02/trace/alert_FTAE02.log"}]
//     sync_period = "5s"
}

local.file_match "local_files3" {
     path_targets = [{__path__ = "/u01/app/oracle/diag/tnslsnr/ltdora01/listener/alert/log.xml"}]
//     sync_period = "5s"
}

loki.source.file "log_scrape" {
    targets    = local.file_match.local_files.targets
    forward_to = [loki.write.grafana_loki3.receiver]
//    tail_from_end = true
}

loki.source.file "log_scrape2" {
    targets    = local.file_match.local_files2.targets
    forward_to = [loki.write.grafana_loki3.receiver]
//    tail_from_end = true
}

loki.source.file "log_scrape3" {
    targets    = local.file_match.local_files3.targets
    forward_to = [loki.write.grafana_loki3.receiver]
//    tail_from_end = true
}

loki.write "grafana_loki3" {
  endpoint {
    url = "http://<ip_of_loki_server>:3100/api/v1/push"
  }
}

I even tried adding loki.write “grafana_loki” and loki.write “grafana_loki2” then mapping the corrosponding loki.source.file to the correct loki.write

I was getting a 404 page not found so i removed it and kept with 1 loki.write.

Any help on this would be greatly appreciated as i have been spending way too much time trying to figure this out. Thanks

I don’t see anything obviously wrong.

  1. Check and make sure alloy can connect to your Loki server.
  2. Check logs.
  3. Reset Alloy’s state file (so it pulls everything again) and see if you get logs.
1 Like

I have stopped and restarted alloy multiple times and no joy. Same issue. I see the port is open from the alloy server to the loki server.

Ncat: Version 7.92 ( Ncat - Netcat for the 21st Century )
Ncat: Connected to <loki_ip>:3100.
Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.

I have checked the logs that i am looking at and it looks like logs are there as we get emails about the logs.

I am an idiot. I found the issue. Looks like even though I checked everything you mentioned i didn’t realize i had the ULR wrong.

I had: url = “http://<ip_of_loki_server>:3100/api/v1/push”

when it should be: url = “http://<ip_of_loki_server>:3100/loki/api/v1/push”

I missed the loki after the port.