Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Fluentdで始めるPrometheus / Prometheus Tokyo Meetup #1
Search
kazegusuri
April 10, 2017
Programming
2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Fluentdで始めるPrometheus / Prometheus Tokyo Meetup #1
Try Prometheus with Fluentd
kazegusuri
April 10, 2017
More Decks by kazegusuri
See All by kazegusuri
go-sqlite3を使ってCloud Spannerエミュレーターを作ってみた / Cloud Spanner emulator with go-sqlite3
kazegusuri
5
6.8k
handy-spanner GCPUG
kazegusuri
4
2.1k
Open SKT: メルペイ開発の裏側 / builderscon tokyo 2019 Open SKT
kazegusuri
22
28k
Keep watching and extending features of gRPC
kazegusuri
3
2.7k
Testing with microservices in merpay
kazegusuri
10
11k
Real World Mercari API Architecture
kazegusuri
1
6.5k
gRPC and REST with gRPC in practice
kazegusuri
19
8.2k
GRPCの実践と現状での利点欠点 / Go Conference 2016 Spring
kazegusuri
44
32k
OutputとBufferedOutputの間の何か
kazegusuri
2
3.5k
Other Decks in Programming
See All in Programming
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
0
140
SREの越境 / SRE Collaboration
y0hgi
0
100
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
6
1.9k
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
280
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.2k
Family mrubyの進捗
kishima
1
120
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
330
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
240
速習iPhone Duo対応
yuukiw00w
1
280
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
1.8k
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
110
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
The Spectacular Lies of Maps
axbom
PRO
1
990
The Cost Of JavaScript in 2023
addyosmani
55
10k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
For a Future-Friendly Web
brad_frost
183
10k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.9k
Un-Boring Meetings
codingconduct
0
420
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Transcript
Fluentdで始めるPrometheus @kazegusuri /Masahiro Sano Prometheus Tokyo Meetup #1
自己紹介 佐野 正浩(@kazegusuri) Principal Engineer@Mercari, Inc. Platform
Team Go と PHP で開発してます
さわってきたもの Fluentd (2012~, v0.10) Docker (2013~, v0.6)
Kubernetes (2015~, v0.10) Prometheus (2015~, v0.13) gRPC (2016~)
さわってきたもの Fluentd (2012~, v0.10) Docker (2013~, v0.6)
Kubernetes (2015~, v0.10) Prometheus (2015~, v0.13) gRPC (2016~)
None
fluent-plugin-prometheus 大きくわけて3つの機能 FluentdにPrometheus用のエンドポイント提供 prometheus Input Plugin
メッセージからメトリクスを取得 prometheus Output/Filter Plugin Fluentd自体の内部メトリクス prometheus_monitor Input Plugin https://github.com/kazegusuri/fluent-plugin-prometheus
prometheus Input Plugin FluentdにPrometheus用のエンドポイント提供 PrometheusからのPull 他のプラグインで取得したメトリクスを返す <source>
@type prometheus port 24231 </source> GET /metrics scrape_configs: - job_name: fluentd static_configs: - targets: - 'localhost:24231‘ metrics_path: /metrics
prometheus Output/Filter plugin メトリクスをログから収集 Output/Filter pluginとして実装 メトリクスはInput
Pluginで回収 アプリケーションの外でメトリクス収集 使えるメトリクスの種類 counter, gauge, summary, histogram 類似のツール https://github.com/google/mtail
メトリクス収集の例 <filter nginx> @type prometheus <metric> name nginx_size_counter_bytes type counter
desc nginx bytes sent key size <labels> host ${hostname} foo bar </labels> </metric> </filter> {"size": 200} {"size": 100} # TYPE nginx_size_counter_bytes counter # HELP nginx_size_counter_bytes nginx bytes sent nginx_size_counter_bytes{host=“hoge",foo="bar"} 100 # TYPE nginx_size_counter_bytes counter # HELP nginx_size_counter_bytes nginx bytes sent nginx_size_counter_bytes{host=“hoge",foo="bar"} 300
prometheus_monitor Input plugin Fluentdの内部状態をメトリクスに monitor_agent プラグイン相当の機能 取得可能なメトリクス
buffer_queue_length buffer_total_queued_size retry_count http://docs.fluentd.org/v0.12/articles/monitoring <match nginx> @type forward @id test_forward disable_retry_limit <server> host 127.0.0.1 </server> </match> fluentd_status_buffer_queue_length{ plugin_id="test_forward", plugin_category="output", type="forward“ } 17 fluentd_status_buffer_total_bytes{ plugin_id="test_forward", plugin_category="output", type="forward“ } 228 fluentd_status_retry_count{ plugin_id="test_forward", plugin_category="output", type="forward“ } 19
prometheus_monitorを使えば監視できそうな気はする だがFluentdで監視したいのはそれだけなのか… retryに失敗しすぎてretry_waitが長過ぎ問題… 実は全部emitに失敗していた… そもそもoutputに来てなかった…
tailしていたと思ったらパスが変わっていた…
prometheus_monitorを使えば監視できそうな気はする だがFluentdで監視したいのはそれだけなのか… retryに失敗しすぎてretry_waitが長過ぎ問題… 実は全部emitに失敗していた… そもそもoutputに来てなかった…
tailしていたと思ったらパスが変わっていた… _人人人人人人人_ > 作ってみた <  ̄Y^Y^Y^Y^Y^Y ̄
prometheus_output_monitor アウトプットプラグインの詳細なメトリクスを収集 収集可能なメトリクス buffer_queue_length buffer_total_bytes
retry_count num_errors ★ emit_count retry_wait ★ (現在のretry_wait (秒)) emit_records (v0.14 only) write_count (v0.14 only) rollback_count (v0.14 only)
prometheus_output_monitor retry_wait で現在のretry_wait がわかる max_retry_wait の設定漏れがわかる num_errors
の差を見ればエラー出過ぎがわかる emit_count の差を見ればそもそも来てないのがわかる
prometheus_tail_monitor in_tail プラグインのメトリクスを収集 pos_fileの情報 position (どこまで読んだか)
inode (読んでいるファイル) pos_fileを指定してなくても動作 labelにファイルのpathが自動で付与
prometheus_tail_monitor positionの差を見ることで in_tail されてないことがわかるよ position自体でログサイズもわかるよ inodeでログローテートされてないことがわかるよ
max_retry_wait 指定無し
max_retry_wait指定有り
max_retry 指定 v0.12 v0.14
tailのposition
まとめ fluent-plugin-prometheus FluentdとPrometheusをつなぐプラグイン Fluentdの監視に必要なメトリクスを収集 他にもネタ(メトリクス)があれば実装します! おわり