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 入門 / Intro...
Search
polar3130
January 16, 2020
Technology
3
2.6k
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.8k
Dapr × Kubernetes ではじめるポータブルなマイクロサービス / portable microservices with Dapr and Kubernetes
polar3130
5
3.1k
Grafana Loki ではじめる Kubernetes ロギング ハンズオン / Grafana Loki getting started
polar3130
8
5.3k
AKS + Azure Event Hubs で試す Dapr の Resource Bindings / dapr resource bindings with AKS and Event Hubs
polar3130
2
730
Monolith によるモダンアーキテクチャの再考 / Rethink modern architectures with Monolith
polar3130
6
4.9k
Grafana Loki で CloudNative なロギングをはじめよう! / Let's begin cloud native logging with Grafana Loki!
polar3130
7
4.3k
Other Decks in Technology
See All in Technology
開発 × 生成AI × コミュニケーション:GENDAの開発現場で感じたコミュニケーションの変化 / GENDA Tech Talk #1
genda
0
230
Foundation Model × VisionKit で実現するローカル OCR
sansantech
PRO
1
370
S3 Glacier のデータを Athena からクエリしようとしたらどうなるのか/try-to-query-s3-glacier-from-athena
emiki
0
220
2時間で300+テーブルをデータ基盤に連携するためのAI活用 / FukuokaDataEngineer
sansan_randd
0
150
Backlog AI アシスタントが切り開く未来
vvatanabe
1
140
結局QUICで通信は速くなるの?
kota_yata
6
5.7k
プロダクトエンジニアリングで開発の楽しさを拡張する話
barometrica
0
170
Serverless Meetup #21
yoshidashingo
1
120
Amazon S3 Vectorsは大規模ベクトル検索を低コスト化するサーバーレスなベクトルデータベースだ #jawsugsaga / S3 Vectors As A Serverless Vector Database
quiver
1
510
Amazon Q と『音楽』-ゲーム音楽もAmazonQで作成してみた感想-
senseofunity129
0
140
AI関数が早くなったので試してみよう
kumakura
0
290
o11yツールを乗り換えた話
tak0x00
2
1.4k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.7k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
332
22k
Making Projects Easy
brettharned
117
6.3k
Embracing the Ebb and Flow
colly
86
4.8k
Building Applications with DynamoDB
mza
96
6.5k
Become a Pro
speakerdeck
PRO
29
5.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
8
550
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
It's Worth the Effort
3n
185
28k
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!