<p>I am stuck on a scenario where I have to get the log folder of container 1 into 2nd container. I have found a solution in which we will create a emptyDir directory.</p>

<pre><code>spec:
  containers:
  - name: app
    image: app-image
    imagePullPolicy: Always
    ports:
    - containerPort: 8080
    volumeMounts:
    - name: logs
      mountPath: /var/log/app/
  - name: uf
    image: splunk/splunkuniversalforwarder
    ...
    volumeMounts:
    - name: logs
      mountPath: /var/log/app/
  volumes:
  - name: logs
    emptyDir: {}
</code></pre>

<p>But in my situation I want to share /usr/var/log/tomcat/ of 1st container into /var/log/message. This is because splunkUF image will monitor /var/log/app/. so I want to share the log folder of different apps, be it  /var/log/app/tomcat or /var/log/messages but at one same location with splunk container /var/log/app/.</p>

<p>I can run copy command to get the log 1 time but how to get the logs continuously? </p>

<p>I don't see an issue here.
you can mount the same volume at a different location in each container.</p>

<p>According to your description this should be something like this:</p>

<pre><code>spec:
  containers:
  - name: app
    image: app-image
    ...
    volumeMounts:
    - name: logs
      mountPath: /usr/var/log/tomcat/
  - name: uf
    image: splunk/splunkuniversalforwarder
    ...
    volumeMounts:
    - name: logs
      mountPath: /var/log/app/
  volumes:
  - name: logs
    emptyDir: {}
</code></pre>
