Comments (5)
@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.
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.
@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.
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.
Closing per previous comment
from fluent-plugin-kubernetes_metadata_filter.
Related Issues (20)
- Remove deprecated journal functionality
- Optimize cache to use event time
- Stop marshaling and unmarshaling meta
- fix dumping of stats and allow configuration to disable it
- [info]: [filter_kube_metadata] Exception encountered parsing namespace watch event. The connection might have been closed. Sleeping for 1 seconds and resetting the namespace watcher.error reading from socket: Connection reset by peer HOT 2
- watch_retry_interval & watch_retry_exponential_backoff_base are not documented HOT 1
- is a changelog maintained anywhere? HOT 2
- Failure while installing fluent-plugin-kubernetes_metadata_filter plugin version 2.10.0 HOT 4
- 410 Gone encountered. Restarting pod watch to reset resource versions HOT 7
- gemfile.lock fluentd version in v2.13.0 HOT 2
- Compatibility with Ruby >= 3 ? HOT 1
- Support Fluentd 1.16.0 HOT 1
- How to debug problem if kubernetes_metadata not add any metadata from k8s? HOT 1
- undefined method `get_namespaces' for k8s client HOT 2
- v2.x release with fluentd 1.16.x support HOT 3
- pod-id filled with null bytes HOT 1
- New version of the plugin HOT 1
- can add "Controlled By" field to meta HOT 1
- Elasticsearch k8s labels issue HOT 3
- Logs with exception connection to api server HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent-plugin-kubernetes_metadata_filter.