Извлечение раздела ОШИБКА из файла журнала java с использованием python - PullRequest
0 голосов
/ 20 марта 2020

Я хотел бы извлечь весь раздел об ошибках из файла журнала java, используя python, ежечасно и отправить этот раздел об ошибках соответствующим членам команды. Я также хочу пропустить раздел с ошибками предыдущего часа.

Вот мой пример файла журнала:

2020-03-19 03:31:10.299  INFO [foo-service,,,] 11 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2020-03-19 04:20:11.942  ERROR [foo-service,8ca1dc1d81dd6c80,8ca1dc1d81dd6c80,false] 11 --- [nio-8080-exec-6] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: InvalidGrantException, Bad credentials

org.springframework.security.oauth2.common.exceptions.InvalidGrantException: Bad credentials
    at org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter.getOAuth2Authentication(ResourceOwnerPasswordTokenGranter.java:79)
    at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:834)

2020-03-19 05:16:10.432  INFO [foo-service,,,] 11 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2020-03-19 05:16:19.284  ERROR [foo-service,cbf09d934052fdae,cbf09d934052fdae,false] 11 --- [nio-8080-exec-5] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: InternalAuthenticationServiceException, User is Disabled

org.springframework.security.authentication.InternalAuthenticationServiceException: User is Disabled
    at org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter.getOAuth2Authentication(ResourceOwnerPasswordTokenGranter.java:71)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.security.authentication.DisabledException: User is Disabled
    at com.kredifi.service.common.user.impl.PersonUserDetailsService.loadUserByUsername(PersonUserDetailsService.java:75)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)
    at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108)
    ... 109 common frames omitted

2020-03-19 05:16:56.057 ERROR [foo-service,c90fd1cb11f1cc8d,c90fd1cb11f1cc8d,false] 11 --- [nio-8080-exec-7] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: InternalAuthenticationServiceException, User is Disabled

org.springframework.security.authentication.InternalAuthenticationServiceException: User is Disabled
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.security.authentication.DisabledException: User is Disabled
    at com.kredifi.service.common.user.impl.PersonUserDetailsService.loadUserByUsername(PersonUserDetailsService.java:75)
    at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108)
    ... 109 common frames omitted

2020-03-19 05:16:10.432  INFO [foo-service,,,] 11 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration

...