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
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
79
47k
PipeCDプラグインへの期待 / Anticipating PipeCD Plugins
atty303
0
120
EmscriptenでC/C++アプリをWASM化してブラウザで動かしてみた
atty303
0
660
良いソフトウェアとコードレビュー / 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
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.3k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
640
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
200
AIで効率化できた業務・日常
ochtum
0
150
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
120
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
290
Webフレームワークの ベンチマークについて
yusukebe
0
180
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
970
The NotImplementedError Problem in Ruby
koic
1
960
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
410
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.6k
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
850
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
What's in a price? How to price your products and services
michaelherold
247
13k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Ethics towards AI in product and experience design
skipperchong
2
320
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
350
Designing for Performance
lara
611
70k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
Leo the Paperboy
mayatellez
7
1.9k
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