Im trying to upgrade beanstalk version from "64bit Amazon Linux 2018.03 v3.4.0 running Tomcat 8.5 Java 8" to "64bit Amazon Linux 2 v4.1.2 running Tomcat 8.5 Corretto 8". I have my app deployed an running successfully on the new platform version (its a simple app - I dont have any ebextension scripts).

However Im missing the logs file "var/log/tomcat/catalina.out". Its missing and Im running blind!

Beanstalk Log Export Before Upgrade:
enter image description here

Beanstalk Log Export After Upgrade:
enter image description here

Comparing the beanstalk log exports its seems the log directory on an ec2 instance has changed from "var/log/tomcat8" to "var/log/tomcat" and "var/log/tomcat/catalina.out" is missing.

And tips or ideas much appreciated how to get back catalina.out file.

2

There are 2 answers

2
Juri Adam On

Just in case someone stumbles upon the same issue. I conclude (assumption) that the missing catalina.out is due to the beanstalk platform upgrade which logging configuration is defined under "/usr/libexec/tomcat/server" & has no output redirection to catalina.out.

You can get back catalina.out with an .ebextension script:

.ebextensions cat catlina.config
files:
    "/etc/rsyslog.d/catalina.conf":
        mode: "0655"
        owner: root
        group: root
        content: |
            #redirect tomcat logs to /var/log/tomcat/catalina.out discarding timestamps since the messages already have them
            template(name="catalinalog" type="string"
                string="%msg%\n")
            if $programname  == 'server' then {
              *.=warning;*.=err;*.=crit;*.=alert;*.=emerg /var/log/tomcat/catalina.out;catalinalog
              *.=info;*.=notice /var/log/tomcat/catalina.out;catalinalog
             }
commands:
    restart_rsyslog:
        command: systemctl restart rsyslog

Redeploy the app and you can see catalina.out under "/var/log/tomcat/"

0
Luis Eduardo Barragán Belfort On

Great solution from Juri. Here is what I ended up doing, addressing the file ownership and group mentioned by Matt

.ebextensions cat catlina.config
files:
    "/etc/rsyslog.d/catalina.conf":
        mode: "0655"
        owner: root
        group: root
        content: |
            #redirect tomcat logs to /var/log/tomcat/catalina.out discarding timestamps since the messages already have them
            template(name="catalinalog" type="string"
                string="%msg%\n")
            if $programname  == 'server' then {
              *.=warning;*.=err;*.=crit;*.=alert;*.=emerg /var/log/tomcat/catalina.out;catalinalog
              *.=info;*.=notice /var/log/tomcat/catalina.out;catalinalog
             }
commands:
    restart_rsyslog:
        command: touch /var/log/tomcat/catalina.out && chown tomcat /var/log/tomcat/catalina.out && chgrp tomcat /var/log/tomcat/catalina.out && systemctl restart rsyslog