<p>I am new to Kubernetes and when I used to work with Docker swarm I was able to redirect logging the following way:</p>

<pre><code>  myapp:
    image: myregistry:443/mydomain/myapp
    deploy:
      mode: global
      restart_policy:
        condition: on-failure
    logging:
      driver: gelf
      options:
        gelf-address: "udp://localhost:12201"
    environment:
      - LOGGING_LEVEL=WARN
</code></pre>

<p>this way, instead of consulting logs using <code>docker service logs -f myapp</code> or in this case <code>kubectl logs -f myapp</code>, I would have them redirected to monitor them in a centralised manner (e.g. using ELK).</p>

<p>Is this possible with Kubernetes? What is the equivalent solution?</p>

<p>Thank you for your help </p>

João Matos
<p>Yes , there are many solutions both opensource and commerial to send all kubernetes logs ( apps and cluster and everything ) to systems like ELK.</p>

<p>Assuming you have the ElasticSearch already setup.</p>

<p>We are using FluentBit to send K8S logs to EFK:</p>

<p><strong>Fluent Bit DaemonSet ready to be used with Elasticsearch on a normal Kubernetes Cluster</strong></p>

<p><a href="https://github.com/fluent/fluent-bit-kubernetes-logging" rel="nofollow noreferrer">https://github.com/fluent/fluent-bit-kubernetes-logging</a></p>

<p>We are also using SearchGurard with ELk to Restrict users to see logs that belong to apps running in thier own namespaces only.</p>
