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
ログのメトリックを取ってみる話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
AGAWA Koji
November 04, 2016
Programming
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ログのメトリックを取ってみる話
logback / Prometheus
AGAWA Koji
November 04, 2016
More Decks by AGAWA Koji
See All by AGAWA Koji
Software Architecture in an AI-Driven World
atty303
80
47k
PipeCDプラグインへの期待 / Anticipating PipeCD Plugins
atty303
0
130
EmscriptenでC/C++アプリをWASM化してブラウザで動かしてみた
atty303
0
680
良いソフトウェアとコードレビュー / Good software and code review
atty303
38
18k
Scala + Caliban で作るGraphQL バックエンド / Making GraphQL Backend with Scala + Caliban
atty303
0
600
Scala.jsとAndroidでドメイン層を共有しよう / Scala.js and Android
atty303
0
820
もう一つのビルドツール mill で作る Docker イメージ / Build docker image with mill the yet another build tool
atty303
2
2.6k
Case of Ad Delivery System is Implemented by Scala and DDD
atty303
4
3.7k
ADC2016: Axion meets HashiCorp
atty303
0
840
Other Decks in Programming
See All in Programming
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
yield再入門 #phpcon
o0h
PRO
0
700
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.7k
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
630
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
540
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
110
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
140
どこまでゆるくて許されるのか
tk3fftk
0
520
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
530
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
160
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
430
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
BBQ
matthewcrist
89
10k
HDC tutorial
michielstock
2
750
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Prompt Engineering for Job Search
mfonobong
0
380
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
190
Being A Developer After 40
akosma
91
590k
Making Projects Easy
brettharned
120
6.7k
From π to Pie charts
rasagy
0
240
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
250
Transcript
ϩάͷϝτϦοΫΛऔͬͯΈΔ @atty303 / AI Studio Dev Group © 2016 CyberAgent,
Inc. 1
ELK stack ͱ͔Ͱϩάऩू͢ ΔΑ͋͘Δ © 2016 CyberAgent, Inc. 2
ϩάͷϝτϦοΫΛܭଌ͢ Δ͋Μ·Γͳͦ͞͏? © 2016 CyberAgent, Inc. 3
͜Μͳײ͡Ͱܭଌͯ͠·͢ 4 DEBUG Ϩϕϧ͔͠ग़͍ͯͳ͍ͷͰ͍·͍ͪ໘നΈ ͳ͍… © 2016 CyberAgent, Inc. 4
4 ϞχλϦϯάʹ Prometheus Λར༻ 4 Prometheus ެࣜͷ Java ΫϥΠΞϯτ 4
https://github.com/prometheus/ client_java 4 simpleclient_logback Ϟδϡʔϧ 4 ϨϕϧผʹϝοηʔδΛܭଌͯ͠ϝτϦ οΫͱͯ͠ग़ྗͯ͘͠ΕΔ Logback ͷ Appender © 2016 CyberAgent, Inc. 5
logback.xml <configuration> <appender name="COUNTER" class="io.prometheus.client.logback.InstrumentedAppender"> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <filter
class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${LOG_STDOUT_LEVEL:-INFO}</level> </filter> <encoder> <pattern>%.-1level %d{MMdd HH:mm:ss.SSS} %thread [%logger{36}] %msg%n</pattern> </encoder> </appender> <root level="DEBUG"> <appender-ref ref="COUNTER" /> <appender-ref ref="STDOUT" /> </root> </configuration> © 2016 CyberAgent, Inc. 6
ϙΠϯτ 4 ϧʔτϩΨʔશϩάΛ appender ʹૹΔ 4 STDOUT appender ͷ ThreasholdFilter
Ͱ ͳϩάΛϑΟϧλϦϯά 4 COUNTER appender ͕ϩάϨϕϧผͷϝο ηʔδΛΧϯτ © 2016 CyberAgent, Inc. 7
ϝτϦοΫܭଌͯ͘͠ΕΔ $ curl http://somewhere:58165/metrics # HELP logback_appender_total Log4j log statements
at various log levels # TYPE logback_appender_total counter logback_appender_total{level="debug",} 8.9142634E7 logback_appender_total{level="warn",} 0.0 logback_appender_total{level="trace",} 0.0 logback_appender_total{level="error",} 2728.0 logback_appender_total{level="info",} 11.0 © 2016 CyberAgent, Inc. 8
ϩάϨϕϧͷఆٛ DEBUG: ։ൃऀʹ͔͠ඞཁͳ͍ใ INFO: ΞϓϦέʔγϣϯͷॲཧঢ়گͳͲਖ਼ৗಈ࡞ Λ͍ͯ͠Δ࣌ͷใ WARN: Τϥʔ͕ग़͕ͨճ෮ग़དྷͨ࣌ͷใ ERROR: Τϥʔ͕ग़ͯճ෮ग़དྷ͖ͳ͍࣌ͷใ
4 ͪΌΜͱϩάϨϕϧͷҙຯ͚Λ͍ͯ͠ͳ͍ͱ ܭଌͯ͠ແҙຯ… © 2016 CyberAgent, Inc. 9
Ξϥʔτϧʔϧ IF rate(logback_appender_total{job="axion-inserter-admin",level="error"}[1m]) > 1 FOR 1m LABELS { severity
= "LOW" } ANNOTATIONS { summary = "Inserter: {{ $value }} error messages found at {{ $labels.instance }}" } 4 ͱΓ͋͑ͣ ERROR ϩά͕ग़͍ͯͨΒΞϥʔ τ 4 ϝοηʔδίϯςφΛݟʹߦ͘… nomad fs <alloc-id> alloc/logs/inserter.stdout.0 © 2016 CyberAgent, Inc. 10
…ͯͳӡ༻Λͯ͠·͢ © 2016 CyberAgent, Inc. 11
ྑ͍ͱ͜Ζ 4 ϩάऩूΑΓѹతʹτϥϑΟοΫ͕খ͍͞ͷ ͰؾָʹಋೖͰ͖Δ 4 ϩάϨϕϧ͚ͩͰҙ֎ͱগͳ͍࿑ྗͰࢹͰ ͖Δ 4 ࢹΛҙࣝͨ͠ϩάग़ྗඞཁ ©
2016 CyberAgent, Inc. 12
ѱ͍ͱ͜Ζ 4 ͕ى͖ͨͱ͖݁ہϝοηʔδΛݟʹߦ͔ ͳ͍ͱ͍͚ͳ͍ 4 ϩάऩूͷΈ͕༻ҙ͞Ε͍ͯΕͦͷ΄͏ ͕ྑ͍ © 2016 CyberAgent,
Inc. 13
GCP ͷ Stackdriver ͏Β·͍͠ © 2016 CyberAgent, Inc. 14
© 2016 CyberAgent, Inc. 15