Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetesログのメタデータ追加処理について調べてみた/kubernetes l...

bells17
November 30, 2020

Kubernetesログのメタデータ追加処理について調べてみた/kubernetes log metadata

Kubernetes Meetup Tokyo #36
https://k8sjp.connpass.com/event/196212/
でLTしたKubernetesのログ周りのお話です

bells17

November 30, 2020
Tweet

More Decks by bells17

Other Decks in Programming

Transcript

  1. ▶ @bells17 ▶ Software Engineer ▶ IDC Frontier inc. ▶

    普段やってること: + Kubernetes 関連コンポーネントの開発 + Kubernetes as a Service開発の調査・研究 ▶ Kubernetes SIG-Docs Japanese localization reviewer ▶ Kubernetes Internal Organizer ▶ #kubenews ▶ @bells17_
  2. Filter plugin? なんか受け取ったログデータをいい感じに加⼯する処理をする種類のプラグイン (という理解) ``` Filter plugins enable Fluentd to

    modify event streams. Some use cases are: 1. Filtering out events by grepping the value of one or more fields. 2. Enriching events by adding new fields. 3. Deleting or masking certain fields for privacy and compliance. ``` https://docs.fluentd.org/filter より
  3. 参考資料 ▶ https://github.com/fluent/fluentd-kubernetes-daemonset ▶ https://docs.fluentd.org/container-deployment/kubernetes ▶ https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter/tree/v2.5.2 ▶ https://qiita.com/sonots/items/a01d2233210b7b059967 fluentd

    label ▶ https://qiita.com/repeatedly/items/e882fdb46dfe85d9556f Fluentd id ▶ https://abicky.net/2017/10/23/110103/ fluentd id ▶ https://docs.fluentd.org/parser/none fluentd none parser ▶ https://github.com/fluent/fluentd-kubernetes-daemonset/tree/53267a7ec7bfd6ead4528a84d97739059e890f2d ▶ https://docs.fluentbit.io/stream-processing/overview データの流れ fluent bitの⽅だけどfluentd側で良い図がなかった ▶ https://docs.fluentd.org/storage storage plugin ▶ https://github.com/fluent-plugin-systemd/fluent-plugin-systemd#input-plugin-configuration systemd source plugin ▶ https://docs.fluentd.org/plugin-development/api-plugin-filter filter plugin の書き⽅ ▶ https://docs.fluentd.org/plugin-development fluentd pluginについて ▶ https://docs.fluentd.org/plugin-development/api-plugin-filter#filter_steam-tag-es filter stream ▶ http://rubykaigi.org/2014/presentation/S-NaotoshiSeo/ fluentd実装 ▶ https://docs.fluentd.org/plugin-development/api-plugin-base base plugin すべてのプラグインの基本 今回は config_param ⽤ ▶ https://github.com/fluent/fluentd/blob/v1.11.5/lib/fluent/plugin/base.rb base plugin 実装 ▶ https://github.com/fluent/fluentd/blob/v1.11.5/lib/fluent/plugin/filter.rb filter plugin 実装 ▶ https://github.com/fluent/fluentd/blob/v1.11.5/lib/fluent/configurable.rb ▶ https://github.com/fluent/fluentd/blob/v1.11.5/lib/fluent/system_config.rb ▶ https://github.com/fluent/fluentd/blob/v1.11.5/lib/fluent/event.rb event stream ▶ https://github.com/SamSaffron/lru_redux スレッドセーフなキャッシュストア ▶ https://docs.ruby-lang.org/ja/latest/class/Thread.html ruby のスレッド ▶ https://github.com/abonas/kubeclient Fluentd Kubernetes Metadata Filter Plugin が使ってる kubernetes client