<p>How can I get all the logs from a specific container(s) that are running in a replica set</p>

<p>I tried this but it's not working</p>

<pre><code>kubectl logs -l=app={app-name},name={container-name} -n={namespace}
</code></pre>

sharpcodes
<p>You need to use <strong>-c flag</strong> to specify the Container name</p>

<p><code>kubectl logs -l=app={app-name} -c={container-name} -n={namespace}</code></p>

<p>As you can see the options with the <code>kubectl logs -h</code> command</p>

<pre><code>Options:
      --all-containers=false: Get all containers's logs in the pod(s).
  -c, --container='': Print the logs of this container
  -f, --follow=false: Specify if the logs should be streamed.
      --limit-bytes=0: Maximum bytes of logs to return. Defaults to no limit.
      --pod-running-timeout=20s: The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one
pod is running
  -p, --previous=false: If true, print the logs for the previous instance of the container in a pod if it exists.
  -l, --selector='': Selector (label query) to filter on.
      --since=0s: Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of
since-time / since may be used.
      --since-time='': Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time /
since may be used.
      --tail=-1: Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise
10, if a selector is provided.
      --timestamps=false: Include timestamps on each line in the log output
</code></pre>
