New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluentd filter to process Kubernetes logs #51405
Comments
/area logging |
@amitkumarj441 Sorry, I don't understand the question/ask :( |
@crassirostris I want kubernetes components logs like kube-apiserver, kube-proxy, kube-dns, kubelet, kube-controller-manager, or kube-scheduler in journald basically I have to find where are getting their logs sent (at least some to journald) and to structure Kubernetes logs . P.S.: You can find further explanation in description above in the issue itself. |
See #39800 for details why it's not currently possible in some setups You can always configure system components to log to stdout in your setup and configure the container runtime to send logs from containers to journald |
In the current deployment the services are started by systemd as "origin-node" and "origin-master". |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Is this a BUG REPORT or FEATURE REQUEST?:
What happened:
I and @mperezco are working on having a Fluentd filter to process kubernetes logs, we created the ConfigMap to add two files (in ingress):
@include configs.d/user/filter-k8s-core-rewrite.conf [
First file is to rewrite the logs coming from services "origin-master" and "origin-node"
]@include configs.d/user/filter-k8s-core-data.conf [
Second file is to tag all kubernetes namespaces
]We already have a common data model namespace for kubernetes https://github.com/ViaQ/elasticsearch-templates/blob/master/namespaces/kubernetes.yml#L22
So we could do something like this instead:
<record>
kubernetes {"namespace_name":"${record['MESSAGE'].match/.*GET\s\/api.*namespaces\/(\w*)\//}"}
</record>
But the problem is - what if there is no match for /.*GET/ ? What will the namespace name be?
Perhaps
record['MESSAGE']
is not coming through as expected?And we're not getting any logs under Kibana with API tags?
What you expected to happen:
To get Kubernetes components logs (kubeapi, kubelet etc.) in journald
How to reproduce it (as minimally and precisely as possible):
We'll try another way to conditionally add a field:
<record>
unused ${record['MESSAGE'].match(/.*GET\s\/api.*namespaces\/(\w*)\//) do |md| record['kubernetes']=Hash.new; record['kubernetes']['namespace_name']=md[1] end}
</record>
remove_keys unused
We tested the regular expression in Rubular as well as in Fluentular
The intention is that in a line that comes from journald like this:
ago 21 18:19:12 viaq.logging.test origin-master[1194]: I0821 18:19:12.249226 1194 panics.go:76]
GET /api/v1/namespaces/logging/endpoints/logging-kibana: (10.89128ms) 200
[[openshift/v1.5.2+43a9be4 (linux/amd64) kubernetes/43a9be4 system:serviceaccount:openshift-
infra:endpoint-controller] 192.168.122.5:47476 http://192.168.122.5:47476]`assigns the record "logging" to "k8s_namespace" ... and shows it in kibana ...
Anything else we need to know?:
We checked our expression according to ruby console which is correct though :
pry(main)> msg = 'ago 21 18:19:12 viaq.logging.test origin-master[1194]: I0821 18:19:12.249226
1194 panics.go:76] GET /api/v1/namespaces/logging/endpoints/logging-kibana: (10.89128ms) 200
[[openshift/v1.5.2+43a9be4 (linux/amd64) kubernetes/43a9be4 system:serviceaccount:openshift-
infra:endpoint-controller] 192.168.122.5:47476 http://192.168.122.5:47476]'panics.go:76] GET /api/v1/namespaces/logging/endpoints/logging-kibana: (10.89128ms) 200
[[openshift/v1.5.2+43a9be4 (linux/amd64) kubernetes/43a9be4 system:serviceaccount:openshift-
infra:endpoint-controller] 192.168.122.5:47476 http://192.168.122.5:47476]"`pry(main)> msg.match(/.*GET\s\/api.*namespaces\/(\w*)\//) do |md| puts md[1] end
logging
=> nil
Other solution could be to add
out_stdout
in many cases to debug.Environment:
Kubernetes version (use
kubectl version
):Cloud provider or hardware configuration**:
OS (e.g. from /etc/os-release): CentOS 7.3
Kernel (e.g.
uname -a
): Linux ith-ThinkPad-W520 4.10.0-32-generic Expand testing of the util package. Now 70% #36~16.04.1-Ubuntu SMP Wed Aug 9 09:19:02 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxInstall tools: ViaQ wrapper
Others:
The text was updated successfully, but these errors were encountered: