<p>I am collect container's log using filebeat in kubernetes cluster, and now collected log shows this error:</p>

<pre><code>2020-06-10T09:26:35.831Z ERROR [kubernetes] add_kubernetes_metadata/matchers.go:91 Error extracting container id - source value does not contain matcher's logs_path '/var/lib/docker/containers/'.
</code></pre>

<p>this is the full log output:</p>

<p><a href="https://i.stack.imgur.com/tn93V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tn93V.png" alt="enter image description here"></a></p>

<p>I find the filebeat was listening is the node meowk8sslave2 and login into this node found the path exists. why the error could happen? this is my filebeat config:</p>

<pre><code>{
    "filebeat.yml": "filebeat.inputs:
        - type: container
          paths:
            - /var/log/containers/*.log
          processors:
          - add_kubernetes_metadata:
              host: ${NODE_NAME}
              matchers:
              - logs_path:
                  logs_path: \"/var/log/containers/\"

        output.elasticsearch:
          host: '${NODE_NAME}'
          hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
        "
}
</code></pre>

<p>Look inside your filebeat pod where exactly the logs are made available.</p>
<p>I was testing the ELK stack on Minikube.</p>
<p>In my case it was inside <code>/var/lib/docker/containers/*/*.log</code></p>
<p>So this one worked for me.</p>
<pre><code>filebeatConfig:
  filebeat.yml: |
    filebeat.inputs:
    - type: container
      paths:
        - /var/lib/docker/containers/*/*.log
      processors:
      - add_kubernetes_metadata:
          host: ${NODE_NAME}
          matchers:
          - logs_path:
              logs_path: &quot;/var/lib/docker/containers/&quot;
    output.elasticsearch:
      host: '${NODE_NAME}'
      hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
</code></pre>
