avniproject / avni-server

Backend APIs for Avni
https://avniproject.org
GNU Affero General Public License v3.0
7 stars 25 forks source link

Server Log Cleanup #473

Open arjunk opened 2 years ago

arjunk commented 2 years ago

Currently the server logs are filled with TokenExpiredException like the one below. This bloats up the logs unnecessarily. Its not even an exception as this will happen with any user after some time and then token should get renewed automatically. We should remove this log or at least not log the whole trace and move it to INFO / DEBUG level. Similarly we should review other such logs and move them to right levels so that it is easier to understand the logs.

ava.lang.RuntimeException: com.auth0.jwt.exceptions.TokenExpiredException: The Token has expired on Sun Oct 02 08:30:01 UTC 2022. at org.avni.service.BaseIAMService.verifyAndDecodeToken(BaseIAMService.java:95) at org.avni.service.BaseIAMService.getUserFromToken(BaseIAMService.java:47) at org.avni.framework.security.AuthService.authenticateByToken(AuthService.java:50) at org.avni.framework.security.AuthenticationFilter.doFilterInternal(AuthenticationFilter.java:45) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)

vinayvenu commented 2 years ago

@arjunk Tried looking up logs, it doesn't seem to be a big issue except during exceptional circumstances. See the log frequency between July 19 and August 25 below. There was something wrong in August 1 and 2, but otherwise, the stack trace is not big enough to cause any trouble.

Date Number of stack traces Log file size (MB) 2022-07-19 22 25 2022-07-20 36 30 2022-07-21 50 25 2022-07-22 32 20 2022-07-23 48 15 2022-07-24 28 15 2022-07-25 38 25 2022-07-26 34 30 2022-07-27 56 30 2022-07-28 36 20 2022-07-29 36 20 2022-07-30 32 20 2022-07-31 16 10 2022-08-01 162 25 2022-08-02 664 25 2022-08-03 82 20 2022-08-04 30 25 2022-08-05 32 20 2022-08-06 36 15 2022-08-07 24 10 2022-08-08 50 25 2022-08-09 34 50 2022-08-10 26 35 2022-08-11 28 15 2022-08-12 28 15 2022-08-13 24 15 2022-08-14 22 10 2022-08-15 24 10 2022-08-16 66 20 2022-08-17 26 20 2022-08-18 30 20 2022-08-19 30 20 2022-08-20 24 15 2022-08-21 24 10 2022-08-22 24 30 2022-08-23 30 30 2022-08-24 94 30