Giter Club home page Giter Club logo

Comments (5)

jcantrill avatar jcantrill commented on May 28, 2024

@r4j4h Given the way this plugin derives metadata for log records, I don't see how it could properly support the Docker fluentd log driver. This plugin needs to understand the Kubernetes namespace in order to properly fetch and cache pod and namespace metadata. The current documentation indicate the driver is only providing container_name. This would require this plugin to jump through a lot of hoops to do the proper correlation if it is even possible to derive that information from the container_name and container_id.

@richm Do you see any way this could be supported in this plugin?

from fluent-plugin-kubernetes_metadata_filter.

richm avatar richm commented on May 28, 2024

What do the log records look like in fluentd when using docker with the fluentd log driver? Specifically, does the tag include the k8s metadata, or is there a CONTAINER_NAME field with the k8s metadata?
Do commands like docker logs and kubectl logs work when using the fluentd log driver?

from fluent-plugin-kubernetes_metadata_filter.

r4j4h avatar r4j4h commented on May 28, 2024

@jcantrill Great point!

@richm I'm not sure as the tailing approach works well enough I have not bothered to try the alternate logging driver. 😊

It does look like this plugin may need to handle the correlation anyway in light of #105 :/

from fluent-plugin-kubernetes_metadata_filter.

Mortega5 avatar Mortega5 commented on May 28, 2024

I'm using this fluentd conf to read logs directly from docker fluentd driver

<source>
  @type forward
  port 8888
  add_tag_prefix log
</source>

<filter log.*>
  @type record_transformer
  enable_ruby
  <record>
    custom_tag  ${record['container_name']}_${record['container_id']}
  </record>
</filter>

<match log.*>
  @type rewrite_tag_filter
  <rule>
    key custom_tag
    pattern /(?<name_prefix>[^_]+)_(?<container_name>[^\._]+)(\.(?<container_hash>[^_]+))?_(?<pod_name>[^_]+)_(?<namespace>[^_]+)_[^_]+_[^_]+_(?<docker_id>[^_]+)$/
    tag kubernetes.$4_$5_$2-$6
  </rule>
</match>

<filter kubernetes.**>
  @type kubernetes_metadata
  kubernetes_url "https://kube.api.url"
  tag_to_kubernetes_name_regexp "kubernetes\.(?<pod_name>[^_]+)_(?<namespace>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})"
  client_cert "/tmp/client.crt"
  client_key "/tmp/client.key"
  verify_ssl false
</filter>

<filter kubernetes.**>
  @type record_transformer
  remove_keys custom_tag
</filter>

<match kubernetes.**>
  @type stdout
</match>

It seems to work

from fluent-plugin-kubernetes_metadata_filter.

jcantrill avatar jcantrill commented on May 28, 2024

Closing per previous comment

from fluent-plugin-kubernetes_metadata_filter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.