Search code examples
syslogrsyslog

Issue with routing to files w/ Syslog


I am trying to set up syslog so that we can have our app in different environments log to different files.

Everything works great for our development environment, but no logs are coming through for our staging environment.

Here is the snippet from our config file, 01-app.conf,

# staging
if ($programname == "api-staging") then {
  action(type="omfile" file="/var/log/staging/api.log")
  stop
}

# development
if ($programname == "api-development") then {
  action(type="omfile" file="/var/log/development/api.log")
  stop
}

user.* /var/log/other/user.log
stop

I have our config file start with 01 because the app logs go to multiple places if they respect the default config before our own.

Given that the development logs are getting routed correctly and that removing stop from the staging rule sends logs to /var/log/other/user.log, I am pretty confident there is not an issue with sending the logs to the box itself, but is somehow a problem with the routing.

An example log from /var/log/other/user.log that should be in /var/log/staging/api.log is this:

Sep 14 17:28:33 RD0003FF77E220 api-staging[58340]: "...", so I know that the programname I am looking for in the config is the correct name.


Solution

  • The syslog user did not have access to the staging directory so it could not write the logs there.