user1578872
user1578872

Reputation: 9088

Kubernetes log location inside the pod

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 haven't 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=&quot;%logger{36}&quot; threadName=&quot;%thread&quot; txnId=&quot;%X{txnId}&quot; %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>

Upvotes: 0

Views: 2074

Answers (1)

manojlds
manojlds

Reputation: 301417

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.

Upvotes: 2

Related Questions