From 2e1ef205b3ed377b8ba7b620fc8a5d6ed972ff89 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Tue, 4 Jul 2017 19:02:24 +0800 Subject: [PATCH] Add two examples about how to analysis audits of kube-apiserver --- docs/tasks/debug-application-cluster/audit.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/docs/tasks/debug-application-cluster/audit.md b/docs/tasks/debug-application-cluster/audit.md index 2d2c6cb3b3a84..355541c39a7c8 100644 --- a/docs/tasks/debug-application-cluster/audit.md +++ b/docs/tasks/debug-application-cluster/audit.md @@ -284,6 +284,129 @@ Events are POSTed as a JSON serialized `EventList`. An example payload: } ``` +### Log Collector Examples + +#### Use fluentd to collect and distribution audit events from log file + +[Fluentd][fluentd] is an open source data collector for unified logging layer. +In this example, we will use fluentd to split audit events by different namespaces. + +1. install [fluentd, fluent-plugin-forest and fluent-plugin-rewrite-tag-filter][fluentd_install_doc] in the kube-apiserver node +2. create a config file for fluentd +``` +$ cat < /etc/fluentd/config + + @type tail + # audit log path of kube-apiserver + path /var/log/kube-audit + pos_file /var/log/audit.pos + format /^(?