<p>I read in kubernetes docs somewhere that kubernetes reads application logs from stdout and stderror in pods. 
I created a new application and configured it to send logs to a remote splunk hec endpoint (using splunk-logback jars) and at the same time to console. 
So by default, the console logs in logback should go to System.out, which should then be visible using kubectl logs .
But it's not happening in my application.</p>

<p>my logback file:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;configuration&gt;

    &lt;Appender name="SPLUNK" class="com.splunk.logging.HttpEventCollectorLogbackAppender"&gt;
        &lt;url&gt;${splunk_hec_url}&lt;/url&gt;
        &lt;token&gt;${splunk_hec_token}&lt;/token&gt;
        &lt;index&gt;${splunk_app_token}&lt;/index&gt;
        &lt;disableCertificateValidation&gt;true&lt;/disableCertificateValidation&gt;
        &lt;batch_size_bytes&gt;1000000&lt;/batch_size_bytes&gt;
        &lt;batch_size_count&gt;${batch_size_count}&lt;/batch_size_count&gt;
        &lt;send_mode&gt;sequential&lt;/send_mode&gt;

        &lt;layout class="ch.qos.logback.classic.PatternLayout"&gt;
            &lt;pattern&gt;%msg&lt;/pattern&gt;
        &lt;/layout&gt;
    &lt;/Appender&gt;

    &lt;Appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&gt;
        &lt;encoder&gt;
            &lt;pattern&gt;%msg&lt;/pattern&gt;
        &lt;/encoder&gt;
    &lt;/Appender&gt;

    &lt;Appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"&gt;
        &lt;appender-ref ref="STDOUT" /&gt;
    &lt;/Appender&gt;

    &lt;root level="INFO"&gt;
        &lt;appender-ref ref="SPLUNK"/&gt;
        &lt;appender-ref ref="ASYNC"/&gt;
    &lt;/root&gt;

&lt;/configuration&gt;
</code></pre>

<p>I am able to see the logs in splunk and If I login to the container from backend and start my java application, then also I can see the logs on the terminal that time. But if I let the container start by default on it's own, then the logs are only going to splunk and I can't view them using <code>kubectl logs &lt;POD_NAME&gt;</code></p>

<p>The kubernetes yml file for my logger app:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
    name: logging-pod
    labels:
       app: logging-pod
spec:
  containers:
     - name: logging-container
       image: logger-splunk:latest
       command: ["java", "-jar", "logger-splunk-1.0-SNAPSHOT.jar"]
       resources:
          requests:
             cpu: 1
             memory: 1Gi
          limits:
             cpu: 1
             memory: 1Gi
</code></pre>

Ashu
<p>ok so this finally got resolved. The issue was with the logs not being flushed.</p>

<p>In the PatternLayout the %n was missing. Hence everything was going into some buffer I guess and not reaching the console.</p>
