spring-boot-admin icon indicating copy to clipboard operation
spring-boot-admin copied to clipboard

logfile viewer 416

Open vpodoprigo opened this issue 3 years ago • 10 comments

Spring Boot version 2.6.3 Spring Boot Admin version 2.6.2 Looks like it is related to https://github.com/codecentric/spring-boot-admin/issues/1632

Look like It is not fixed enough

  1. logs not loaded at all изображение And logs are opened in case if open it in new tab

2)logs are loaded but there is error requests spam изображение изображение

vpodoprigo avatar Apr 04 '22 07:04 vpodoprigo

It always happens after rolling over of logs(i have mixed roll over by size and date)

vpodoprigo avatar Apr 04 '22 07:04 vpodoprigo

Hi @vpodoprigo

the 1. point looks like a bug, we will have a look. If you can provide any more details please add them as comment.

The 2. point is expected behaviour I would say. The client (browser) does not know when the files are rolled over. It is just polling for the next batch. So it needs the error response to know there is nothing more to load (because of rollover). Then it can start at the beginning of the file again.

erikpetzold avatar Apr 08 '22 06:04 erikpetzold

Hi @erikpetzold. 2) I agree if it happpens once but it goes to loop. изображение

according to the commit i see that next lines were removed:

        // Reload the last byte to avoid a 416: Range unsatisfiable.
        // If the response has length = 1 the file hasn't beent changed.
        // If the response status is 416 the logfile has been truncated.
        range = `bytes=${size - 1}-`;

I suppose it is the reason for point 2

vpodoprigo avatar Apr 08 '22 07:04 vpodoprigo

for the 1 point: after the roll over i see request with range: bytes= -307200. it works if there was not rollover but it doesnt work after the first roll over. i dont know reason...

vpodoprigo avatar Apr 08 '22 08:04 vpodoprigo

Additionally to 1): i did experiment via postman. I did the same request as spring boot admin does directly to instance and it works. (url /actuator/logfile range: bytes= -307200) But it doesn't work if i use spring boot admin endpoint proxy. (url /admin/instances/fd062a9e417f/actuator/logfile range: bytes= -307200)

So i suppose there is problem inside spring boot admin server proxy endpoints

vpodoprigo avatar Apr 08 '22 08:04 vpodoprigo

Hi @vpodoprigo , I assume you are using the servlet variant of Spring Boot Admin, since this is the only way I was able to reproduce the bug in an older version of SBA.

  1. This issue should have been fixed with #1632 . Could you please try the newest version of Spring Boot Admin and retest?
  2. This should be the expected behaviour after the fix (rolling file bug). Could you provide a sample project which reproduces your bug? We assume the issue could be connected to a logfile configuration we haven't addressed in our observations so far. I only was able to reproduce a 416 status code with each request with a logback config including a very small max-file-size (logging.logback.rollingpolicy.max-file-size). So in my case, the logfile was rolling over after each request which resulted in a new successful request with a 206 state including the content of the newly created file.

However, there still seems to be a bug with the reactive variant of Spring Boot Admin which uses webflux. The endpoint 'actuator/logfile' is returning a BAD_REQUEST status while watching the Logfile view in case of a rolling logfile. This results in the same bug described in 1) -> The Logfile view stops updating. We will fix this issue in a future version.

ulischulte avatar Apr 29 '22 07:04 ulischulte

Hi @ulischulte . There is the same issue with latest version. I use the servlet variant of Spring Boot Admin with Eureka Server packed inside. Also tried version where the next code is not removed and it works for point 2)

        // Reload the last byte to avoid a 416: Range unsatisfiable.
        // If the response has length = 1 the file hasn't beent changed.
        // If the response status is 416 the logfile has been truncated.
        range = `bytes=${size - 1}-`;

But I still have issue with 1) in any version(for old version i at least have button "Dowload log file" for latest i dont have ever this button).

vpodoprigo avatar Apr 29 '22 12:04 vpodoprigo

About logging configuration: it is standard spring boot config. The only option i have is

logging:
  file:
    name: app.log

that is all(i dont have any custom logback configurations).

vpodoprigo avatar Apr 29 '22 13:04 vpodoprigo

But you wrote that you have rollover, so there must be some more config?

It always happens after rolling over of logs(i have mixed roll over by size and date)

erikpetzold avatar Apr 29 '22 13:04 erikpetzold

@erikpetzold No. Rollover is the default configuration for file appender in spring boot You can find default config here: .m2\repository\org\springframework\boot\spring-boot\2.6.3\spring-boot-2.6.3.jar!\org\springframework\boot\logging\logback\file-appender.xml

vpodoprigo avatar Apr 29 '22 13:04 vpodoprigo

Not sure if related but I have an issue with logfile view on 3.0.0-M4 - the page appears blank, however, if you generate enough log entries it starts to appear but at the top of the page (thru page header etc).

woodforda avatar Sep 25 '22 15:09 woodforda

Closed due to inactivity. Feel free to reopen if issue still exists.

SteKoe avatar May 26 '23 07:05 SteKoe

In the Spring Boot 3.x version, I use the logging.logback.rollingpolicy.max-file-size property to give a log file size but After I removed this property, this error was gone.

pulasthi-Narada avatar Mar 09 '24 02:03 pulasthi-Narada