Alloy doesn't collect Tomcat log

Hi!
I try to organize a simple schema to transfer logs (only, without metrics!) from tomcat server to Loki+Grafana on Linux.
Initially I configured alloy to collect and send linux logs to Loki and it’s working normally.

After I tried to add section for Tomcat, but after sending first batch to Loki, it doesn’t send anymore. I don’t see any error in alloy log messages.
Only glue, that I could found, is position file is empty: “positions: {}”

I use slightly modified example from here.

local.file_match "logs_integrations_tomcat_linux" {
    path_targets = [{
        __address__ = "localhost",
        __path__    = "/{var,opt,usr/local}/{log,*tomcat*}/{*custom*}/{*tomcat*,logs}/catalina.out",
        instance    = "server_name",
        job         = "integrations/tomcat",
    }]
}

loki.source.file "logs_integrations_tomcat_linux" {
    targets    = local.file_match.logs_integrations_tomcat_linux.targets
    forward_to = [loki.write.grafana_logs.receiver]
}

If someone could give an advice or at least say, where could I check more?

1 Like

can you point us to documentation for this __path__ you are using?

/{var,opt,usr/local}/{log,*tomcat*}/{*custom*}/{*tomcat*,logs}/catalina.out

I gave a link in original message. I slightly adjusted path to our configuration of Tomcat. Here is a quote from page.

local.file_match "logs_integrations_tomcat_linux" {
    path_targets = [{
        __address__ = "localhost",
        __path__    = "/{var,opt,usr/local}/{log,*tomcat*}/{*tomcat*,logs}/catalina.out",
        instance    = constants.hostname,
        job         = "integrations/tomcat",
    }]
}
loki.source.file "logs_integrations_tomcat_linux" {
    targets    = local.file_match.logs_integrations_tomcat_linux.targets
    forward_to = [loki.write.grafana_cloud_loki.receiver]
}

interesting, that “advanced snippet” below on the page are completely the same…

Hello! It might be useful to look at the targets of loki.source.file using the UI.