Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Grafana Loki の Docker Logging Driver 入門 / Introduction of Docker Logging Driver for Grafana Loki
Search
polar3130
January 16, 2020
Technology
3
2.3k
Grafana Loki の Docker Logging Driver 入門 / Introduction of Docker Logging Driver for Grafana Loki
Docker Meetup Tokyo #34
「Grafana Loki の Docker Logging Driver 入門」のスライド資料です
polar3130
January 16, 2020
Tweet
Share
More Decks by polar3130
See All by polar3130
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ / Design and operations of GKE and Anthos Service Mesh for enterprises
polar3130
0
2.5k
Dapr × Kubernetes ではじめるポータブルなマイクロサービス / portable microservices with Dapr and Kubernetes
polar3130
5
2.8k
Grafana Loki ではじめる Kubernetes ロギング ハンズオン / Grafana Loki getting started
polar3130
8
4.8k
AKS + Azure Event Hubs で試す Dapr の Resource Bindings / dapr resource bindings with AKS and Event Hubs
polar3130
2
640
Monolith によるモダンアーキテクチャの再考 / Rethink modern architectures with Monolith
polar3130
6
4.5k
Grafana Loki で CloudNative なロギングをはじめよう! / Let's begin cloud native logging with Grafana Loki!
polar3130
6
3.9k
Other Decks in Technology
See All in Technology
エンジニアの生存戦略 〜クラウド潮流の経験から紐解く技術トレンドのメカニズムと乗りこなし方〜
shimy
9
1.9k
AWSサービスメニュー開発をしていてAWSを好きだ!と感じた瞬間
toru_kubota
0
130
AI研修【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
130
Azure Pipelinesを使用したCICDベースラインアーキテクチャ実践
yuriemori
0
190
公共領域から学ぶ クラウド移行についてエンジニアが意識していること
kawakawa2222
0
140
AWSでRAGを作る法方
sonoda_mj
1
140
AutomatedLabを使って内部ペンテストを勉強しよう! -やられ社内ネットワークの自動構築-
n_etupirka
1
610
セキュリティ研修 Day1【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
160
コミュニティサービスに「あなたへ」フィードを リリースするまでの試行錯誤
takapy
1
150
Git 研修 Advanced【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
200
プレイドにおけるDatadog APMの活用方法
plaidtech
PRO
2
120
運用改善、不都合な真実 / 20240722-ssmjp-kaizen
opelab
17
8k
Featured
See All Featured
Designing Experiences People Love
moore
136
23k
Raft: Consensus for Rubyists
vanstee
134
6.5k
Pencils Down: Stop Designing & Start Developing
hursman
118
11k
Atom: Resistance is Futile
akmur
261
25k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
16
1.6k
Why Our Code Smells
bkeepers
PRO
332
56k
Teambox: Starting and Learning
jrom
130
8.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
18
1.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
34
1.9k
Clear Off the Table
cherdarchuk
89
320k
How GitHub Uses GitHub to Build GitHub
holman
471
290k
Unsuck your backbone
ammeep
666
57k
Transcript
Grafana Loki の Docker Logging Driver 入門 Masahiko Utsunomiya 2020/1/16
Docker Meetup Tokyo #34
1 #dockertokyo 掲載内容は個人の見解であり、 所属する企業や組織の立場、戦略、意見を 代表するものではありません
2 #dockertokyo Whois ✓ 金融分野のお客様のクラウド導入支援 ✓ 興味:Observability(Prometheus, Fluentd, Loki, Jaeger,
etc.) ✓ Grafana Loki コントリビュータ Helm Chart のメンテナンスなどしています polar3130 Masahiko Utsunomiya Infrastructure Engineer / Relationship Builder
3 #dockertokyo 制作に参加した書籍がでました “Kubernetes ポケットリファレンス” ISBN : 978-4-297-10957-8 2019/11/16発売 技術評論社より
主にレビュアとして参加、 本編・コラムの一部執筆も担当させて頂きました
4 #dockertokyo Docker のログ、どうしてますか 例えば、次のような環境で動いているシステムのログ収集を... ホストのログは Cloudwatch Logs へ Docker
エンジンのログは rsyslog でファイルサーバへ application アプリケーションのログは Fluentd で Elasticsearch へ
5 #dockertokyo Docker のログ、どうしてますか バラバラに収集すると後から特定のログを探すのは大変 ホストのログは Cloudwatch Logs へ Docker
エンジンのログは rsyslog でファイルサーバへ application アプリケーションのログは Fluentd で Elasticsearch へ アプリの利用傾向から 将来のリソースを予測したい、 ログから相関とかわからない? 監査に必要だから この期間の関連するログを 全部もってきて! デバッグしたいけど、 関連するログは どこに置いてあったっけ?
6 #dockertokyo 目的と手段のミスマッチ 改変できない、されていないと 証明できることが必要 プロセスの透明性が重視される 軽量性、高可用性が必要 できるだけ多くの生ログと、 簡便なgrepツールが求められる Logging
短期的目線 長期的目線 監査・実績管理 傾向分析・予測 複雑な二次加工が必要(傾向) 多角的な集計・フィルタリング ができるツールが求められる デバッグ 傾向分析・予測 目的に合わない手段では、ログの運用負荷が不必要に高まる場合がある
7 #dockertokyo 手段に応じたロギングドライバの選択 Docker はロギングソリューションに応じてドライバを変更できる デフォルトは json-file, その他は Fluentd などがサポートされている
公式にないものもプラグインをインストールして利用可能 none local json-file (default) journald syslog gelf fluentd awslogs splunk etwlogs gcplogs logentries ◦ docker logs ✕ docker logs (Docker CEの場合) built-in logging drivers※ $ docker plugin install <org/image> logging driver plugins ※ Docker v19.03
8 #dockertokyo ロギングドライバの設定 デフォルトのロギングドライバは daemon.json で設定 log-opts にドライバに応じたオプション設定を追記 コンテナ起動時にドライバを個別指定することも可能 参考:https://docs.docker.com/config/containers/logging/configure/
daemon.json { "log-driver": "syslog", "log-opts": { "syslog-address": "udp://1.2.3.4:1111" } } $ vim /etc/docker/daemon.json $ docker info --format '{{.LoggingDriver}}' syslog $ docker run --name hoge ... $ docker inspect hoge --format '{{.HostConfig.LogConfig.Type}}’ syslog
9 #dockertokyo ロギングドライバの設定 デフォルトのロギングドライバは daemon.json で設定 log-opts にドライバに応じたオプション設定を追記 コンテナ起動時にドライバを個別指定することも可能 参考:https://docs.docker.com/config/containers/logging/configure/
daemon.json { "log-driver": "syslog", "log-opts": { "syslog-address": "udp://1.2.3.4:1111" } } $ vim /etc/docker/daemon.json $ docker info --format '{{.LoggingDriver}}' syslog $ docker run --name hoge --log-driver json-file ... $ docker inspect hoge --format '{{.HostConfig.LogConfig.Type}}’ json-file
10 #dockertokyo • 圧縮された非構造化ログとメタデータのインデックスのみを扱うことで軽量に動作 • Prometheusにインスパイアされた設計: 時系列データベース、サービスディスカバリ、ラベルによる多次元データモデル • 水平スケーラビリティ、高可用性、マルチテナンシーをデフォルトで組み込み Grafana
Labs が開発中のOSSロギングツール (以降、Lokiと記載) - latest: v1.2.0 (KubeCon + CloudNativeCon NA 2019 にて GA) - Github Star 8,416(1/11時点) - Go 言語で開発 - https://grafana.com/loki like Prometheus, but for logs. Grafana Loki とは
11 #dockertokyo Grafana Loki の Docker ロギングドライバ logging driver plugins
のひとつとして公開されているドライバ 下記のように docker plugin コマンドでインストール Loki サーバ または Grafana Cloud へのログ転送をサポート インストールが完了すれば daemon.json でデフォルトドライバにも指定可能 デュアルロギング方式 Docker Enterprise Edition のように、json-file 形式も併せて出力される Loki サーバとの接続に問題がある場合でもホスト上で docker logs によりログを確認できる $ docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
12 #dockertokyo Grafana Loki によるログ検索 Grafana Loki Logging Driver for
Loki コンテキストに応じた ラベルを選択し、 grep感覚でフィルタリング ログの量や頻度に応じた メトリクスも生成できる ラベルベースで コンテナを横断した 検索が可能
13 #dockertokyo ご案内:Grafana Loki のハンズオンやります 1/31(金) の NTT Tech Conference
#4 にて開催 GCP + Kubernetes の環境でクラスタレベルロギングについて学べるワークショップです https://ntt-techconf.connpass.com/event/161866/
14 #dockertokyo まとめ 目的に応じたロギングソリューションを選択する ログはモニタリングの中でも特にデータ量が多いテレメトリ 無作為に収集するとログ管理の運用負荷が不必要に増える ソリューションに応じて Docker のロギングドライバを使い分ける デフォルト設定は
/etc/docker/daemon.json で指定 コンテナ起動時に明示すればオーバーライドも可能 Loki スタックによる Docker ロギングソリューション ラベルベースでコンテナやノードを横断的に検索でき、軽量かつ直感的 Docker Compose や Swarm など複数のコンテナを実行する環境で特に有効
Thank you for your attention!