4

I came accross this article for setting access logs in microservices:

However, in production access logs go up to a GB of data which makes quick looking into logs impossible.

Can it be configured as a rolling log?

1

I did a research about this. sharing my findings here.

Tomcat logs grow with no enforced size limits, they roll only once per day and are never purged in Tomcat.

Tomcat uses JULI logging by default, which does not provide for log file rotation based on the file size limit. The default JULI logging configuration will allow log files to grow unbounded and they will only roll once per day at the date change.

I can see some reference below solution to Switch Tomcat from JULI logging to log4j for Tomcat windows service. but not sure it's possible to do it in our DXD microservices since it uses Tomcat embedded with spring boot, I noticed our DXD 11.5 service uses tomcat-embed-core-9.0.35.jar. It looks like it uses Tomcat 9.0 jars.

In case if you are using AWS Elastic application load balancer then you could also think of enabling access logs in the ELB to S3 bucket. There are some tools available to analyze those logs.

https://knowledge.informatica.com/s/article/146885?language=en_US#:~:text=This%20solution%20using%20log4j%20will,of%20these%20settings%20are%20configurable.

https://www.mulesoft.com/tcat/tomcat-logging

https://db-blog.web.cern.ch/blog/luis-rodriguez-fernandez/2019-03-keeping-your-logs-clean-apache-tomcat-9-log4j2-and-spring-boot

1

We looked into the SpringBoot and Tomcat versions used and we can see that the setting which controls rotation based on format is not available on 8.5. See below more details.

8.5 uses SpringBoot 1.4.7.RELEASE + Tomcat 8.5.54

9.5 uses SpringBoot 2.1.18.RELEASE + Tomcat 9.0.45

The setting in question is not available in SpringBoot 1.4.7, but it is in SpringBoot 2.1.18:

server.tomcat.accesslog.fileDateFormat=.yyyy-MM-dd.HH

The following links contain a list of all available settings.

https://docs.spring.io/spring-boot/docs/1.4.7.RELEASE/reference/html/common-application-properties.html https://docs.spring.io/spring-boot/docs/2.1.18.RELEASE/reference/html/common-application-properties.html

So rolling access log is not possible in 8.5

0

you can refer to the following links apache_Access_Log_Valve and Extended_Access_Log_Valve

Example : on application.properties server.tomcat.accesslog.suffix=.log

server.tomcat.accesslog.enabled=true ( Should work)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.