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
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
act1-costs.pdf
sumedhbala
0
120
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
230
Oxcを導入して開発体験が向上した話
yug1224
4
340
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
300
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
310
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
130
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
600
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
190
The NotImplementedError Problem in Ruby
koic
1
960
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
170
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
640
Performance Engineering for Everyone
elenatanasoiu
0
230
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
170
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
260
Mobile First: as difficult as doing things right
swwweet
225
10k
Statistics for Hackers
jakevdp
799
230k
Utilizing Notion as your number one productivity tool
mfonobong
4
330
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Color Theory Basics | Prateek | Gurzu
gurzu
0
370
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
870
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
150
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
610
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