Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing tomcat logs (catalina.out) after Beanstalk upgrade to "64bit Amazon Linux 2 v4.1.2 running Tomcat 8.5 Corretto 8"

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.

like image 686
Juri Tichomirow Avatar asked Oct 15 '20 11:10

Juri Tichomirow


People also ask

How do I find Tomcat Catalina logs?

By default, the catalina. out file is located in the logs directory under Tomcat's root directory. For example, /opt/netiq/idm/apps/tomcat/logs/catalina.

What is Catalina out in Tomcat?

Catalina. out simply contains everything that is written to Tomcat's "System. out" and "System.


1 Answers

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/"

like image 138
Juri Tichomirow Avatar answered Sep 24 '22 17:09

Juri Tichomirow