2

I'm looking to have my log files available to an admin without needing to ssh to the host.

Hopefully something easy as http://myhost:myport/logs/app.log .

Is there any way to expose an endpoint using Spring Boot that would serve my log files?

ronif
  • 695
  • 1
  • 6
  • 14

1 Answers1

3

Spring Boot Actuator

Add the following dependency to your application:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

And out of the box you'll get a lot of useful endpoints including: /logfile

No additional configuration necessary.

Kyle Anderson
  • 6,801
  • 1
  • 29
  • 41
  • 1
    Thanks! Again, with Spring Boot, it was just too easy. I had already set up actuator but didn't realize that was all that's needed, while I had spent my time trying to expose the logs as a static resource instead. – ronif Jul 29 '16 at 20:42
  • it should be `/loggers/{...}`, `/logfile` without the `/loggers/` does not work on my end. – Minjun Yu Feb 09 '18 at 22:54