Kubernetes log location inside the pod

6/27/2018

I have a docker image for a Spring boot app with the log file location as --logging.config=/conf/logs/logback.xml and the log file is as follows.

I am able to get the logs as

kubectl log POD_NAME

But, unable to find the log file when i log in to the pod. Is there any default location where the log file is placed as I havent mentioned the logging location in the logback.xml file.

Logback file,

<?xml version="1.0" ?>
<configuration>
    <property name="server.encoder.pattern"
        value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} %-5level : loggerName="%logger{36}" threadName="%thread" txnId="%X{txnId}" %msg%n" />
    <property name="metrics.encoder.pattern"
        value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} %-5level : %msg%n" />

    <!-- Enable LevelChangePropagator for jul-to-slf4j optimization -->
    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator" />

    <appender name="METRICS" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${metrics.encoder.pattern}</pattern>
        </encoder>
    </appender>

    <logger name="appengAluminumMetricsLogger" additivity="false">
        <appender-ref ref="METRICS" />
    </logger>

    <appender name="SERVER" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${server.encoder.pattern}</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="SERVER" />
    </root>
</configuration>

Thanks

-- user1578872
kubernetes

1 Answer

6/27/2018

What you see from kubectl logs is console log from your service. Only console log can be seen like that and this is via docker logs support.

-- manojlds
Source: StackOverflow