Carsten_Schmitz

PSA: redirect smgr/java output to it's own log file

Discussion created by Carsten_Schmitz on Apr 23, 2018

Hi.

 

Automic has historically always had configurable log files for their components, which defaulted to the somewhat questionable "temp" directory underneath the installation directory.

 

I recently noticed that some Automic component in 12.1 has started dumping it's log messages partly to syslog. I don't know exactly what facility they use (probably "info"), but on a RedHat-style system this leads to Automic messages being written to /var/log/messages. Which is anoying, especially if some bug in Automic starts flooding that log with a flurry of java exceptions. Ironically, the message that a new log file in "temp" has been switched to is now itself written to /var/log/messages /at least on my installation):

 

Apr 23 13:36:37 example.com ucybsmgr: Logfile changed to /opt/ae/current/server/temp/WPsrv_log_004_00.txt

 

I have a ticket open for this, but I don't believe this will be easily resolved because I have come to the conclusion that this is again a product design issue that should be looked at on a wider scale. The issue is this:

 

Normally, using syslog is fine. It's encouraged even. But if you ship software that logs to syslog, you usually ship a file for /etrc/rsyslog.d which tells syslog to write your output to a dedicated log file. To do this, you need a Linux distribution-dependent software distribution, usually RPM or deb packages or somesuch.

 

Since Automic has historically not ... erm ... cared at all about the standards the rest of the world has mostly agreed upon for shipping Linux software and just ships a tarball with a bunch of binaries and text files instead (you may or may not recognize that I may have a pet peeve with that), each of us will probably end up having to create a syslog config for this as well as part of our server installation procedure. This is part of a bigger issue with ignoring Linux packaging standards which becomes more and more pronounced when one embcares the Java/Tomcat/Frameworks/Postgres bandwagon no less (package dependencies anyone?)

 

At least for now, I have created the small file for /etc/rsyslog.d which Automic should probably ship, and will roll this out to all of my 12.x servers. You can use this, too, if you're on a RH-style Linux (you may need to adapt it to other distributions syslogs, this is for rsyslog). Paste this into a file in /etc/rsyslog.d and reload the service:

 

:syslogtag, startswith, "ucybsmgr" -/var/log/automic.log
& ~

followed by:

 

service rsyslog restart

 

The "& -" stops further processing. If you omit it, your messages will be written to both logs, automic.log and messages. You probably want to adjust file name and path, this is just an example.

 

Additionally, you'll probably also want something like this:

 

/etc/logrotate.d/automic:

/var/log/automic.log {
    rotate 7
    weekly
    compress
    missingok
    notifempty
    noshred

    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

 

Best regards,

Carsten

Outcomes