Spring-boot-admin: How to download and view log?

Created on 5 Jul 2018  路  7Comments  路  Source: codecentric/spring-boot-admin

Hi, I am using 1.5.7 SBA, and my other existing app (log4j2) is at 1.5.14.

That app registered to the SBA successfully, I can see details/ . Hoever the Logging tab only shows the logging level button. I want to be able to download logs and flow/view logs, how can I do that?

thanks

Most helpful comment

The /logfile endpoint of spring boot actuator needs to be enabled. Please read the boot docs on how to achieve that, this is no SBA issue.

Hint: there is a management.endpoint.logfile.external-file property that you can use to activate the logfile input (in case you don't set logging.path or logging.file)

All 7 comments

I was using console logging, after I switched to file, still no log tab, or no buttons to download or view log...

this is my log config

<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60">
    <Appenders>
        <RollingFile name="App-File-Appender" fileName="d:/temp/my/log.log" 
                     filePattern="d:/temp/my/log-%d{yyyy-MM-dd}-%i.log">
            <PatternLayout>
                <Pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</Pattern>
            </PatternLayout>
            <Policies>
                <SizeBasedTriggeringPolicy size="10MB" />
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
    </Appenders>

    <Loggers>
        <logger name="org.springframework" level="info" additivity="false">
          <AppenderRef ref="App-File-Appender" />
        </logger>
        <logger name="org.hibernate" level="info" additivity="false">
          <AppenderRef ref="App-File-Appender" />
        </logger>

        <Root level="info">
            <AppenderRef ref="App-File-Appender"/>
        </Root>
    </Loggers>
</Configuration>

I checked d:/temp/my has the log file.

The /logfile endpoint of spring boot actuator needs to be enabled. Please read the boot docs on how to achieve that, this is no SBA issue.

Hint: there is a management.endpoint.logfile.external-file property that you can use to activate the logfile input (in case you don't set logging.path or logging.file)

@joshiste thanks. It is working now. I had to specify logging.file in my config. logging.path doesn't work.

As you can see I have a logging.config, which points to a log4j2.xml file, and inside it, I use a roller appender. Is there way to let SBA show these old logs as downloadable file? (in my logging config, I set the max size of the log is 10M, so if it reaches this size, it will rename to ,log and then create a new log file. So I would like to download these .log from SBA. Is this supported?

thanks

as the spring boot actuator endpoint has no support for this, sba also doesn't has

Thanks for the explanation :-)

Hello guys,
Thanks a lot for this topic it was very benefits.

@Mike-the-one : I have the same problem as you with logback roller appender. if you found any solution or workaround, please post it here. :)

regards,

Was this page helpful?
0 / 5 - 0 ratings