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でアクセスログをゴニョった話 / Aggregating Access Logs...
Search
Shinya Tsunematsu
May 22, 2012
Technology
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Fluentdでアクセスログをゴニョった話 / Aggregating Access Logs and Visualizing with Fluentd
2012/05/18 Fluentd Casual Talks #1 LT資料
Shinya Tsunematsu
May 22, 2012
More Decks by Shinya Tsunematsu
See All by Shinya Tsunematsu
GMOペパボでのSREの実践 / SRE Practices of GMO Pepabo, Inc.
tnmt
3
5.1k
ペパボサービスインフラの今までこれから / pepabo infra past and future
tnmt
3
750
知らなかった、時に困るWebサービスのセキュリティ対策 / Where Do We Start With Information Security?
tnmt
19
9.7k
IaaSをいじっている人が PaaSについて考えたこと / Should We Prepare Own PaaS?
tnmt
5
2.4k
成長を支援する “ふりかえり”の技術 / How to lockback using "furik"
tnmt
7
1.9k
こんにちわ福岡 / hello-fukuoka
tnmt
0
1.4k
Inside Nyah & Future - A case of "Private Cloud" using OpenStack -
tnmt
0
310
OpenStackクラスタ間マイグレーション事例 Havana to Mitaka / OpenStack Migration Case (Shift from Havana to Mitaka)
tnmt
1
1.2k
ペパボのプライベートクラウド "Nyah" その後 / Pepabo's PrivateCloud "Nyah" After That
tnmt
8
13k
Other Decks in Technology
See All in Technology
re:Inventで、人生は変わったのか? / growth-builders-hub-1-reinvent-2026
mhrtech
2
310
コードレビューをなくして見えたもの
henteko
0
130
AWSを利用する上で知っておきたい名前解決の話 2026
nagisa53
2
300
公共システムAdventCalendar2026
toru_kubota
0
160
AIで選択肢が広がった組織設計の理想と現実
konifar
16
7.7k
Software Engineering in an AI-Driven World
erikjhordan_rey
0
110
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
3
150
kintoneで在庫管理システムを作るときの要件定義・設計ポイント
kai0707
0
230
Active Directory と Entra ID のむむむな関係
murachiakira
PRO
2
980
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
6
3k
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
1
210
【dbts2026】AIエージェントの 判断と探索を変える、 データベース エンジニアリング― 既存DBの処理と依存関係から作る、オペレーショナルオントロジー ―
shisyu_gaku
0
100
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
500
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
550
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Producing Creativity
orderedlist
PRO
348
41k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
970
The Cult of Friendly URLs
andyhume
79
7.1k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Designing Powerful Visuals for Engaging Learning
tmiket
1
630
Code Review Best Practice
trishagee
74
20k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
590
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
620
Transcript
Fluentdでアクセスログを ゴニョった話 導入のTipsとか分かったこととか Fluentd Casual Talks LT Shinya Tsunematsu @tnmt
Fluentdがキテるらしい • けど使ったことない • 使い道とか何が嬉しいのか分からない • 今度Fluentd Casual Talksというのをやるらしい
お酒って怖いですね
というわけで • 初めて触ってみた俺ですが • 導入するまでと • やってみた感想を • それこそもうカジュアルにザーッとお話します •
これから始める方の参考になれば幸いです
何をしようか
30days Album 画像APIサーバのアクセスログ • 画像ストレージは複数のサービスから参照され ている • アクセスログの「分析」みたいなことは特にやっ てきていなかった •
必要に応じて手でログをゴニョる程度
やってみよう • 画像ストレージのサービスごとの利用内訳をグ ラフ化
こんな感じ ログ集約 サーバ ストレージAPI (lighttpd Catalyst) Fluentd Fluentd Growth Forecast
インストールする
rbenv + bunder が 便利 • rbenv: 複数バージョンRubyの管理ツール • システム全体に影響与えずに個人ユーザ権限
で気軽に始められる • 古いディストリでも新しいRuby使える • plugin追加もGemfileに追加してbundle install すればOK の後に画像API側はtd-agentとか fluent-agent-liteとかでも良かったなと…
rbenv入ってたらこれだけ # mkdir -p $HOME/work/fluentd # cd $HOME/work/fluentd # cat
<< EOF > Gemfile source "http://rubygems.org" gem 'fluentd' EOF # bundle install --path vendor/bundle
GrowthForecast # cd $HOME/work # git clone git://github.com/kazeburo/GrowthForecast.git # cd
GrowthForecast # sudo yum -y install cairo-devel pango-devel libxml2-devel # cpanm -l extlib Alien::RRDtool
実際の設定
送り元サーバ設定(1) # アクセスログをフォーマットでバラして <source> type tail format /^(?<host>[^ ]*) (?<vhost>[^
]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$/ pos_file ./pos.txt path /var/log/lighttpd/access.log tag api.access </source>
送り元サーバ設定(2) # 集約サーバに送る <match api.access> type forward flush_interval 10 <server>
name delegate host 192.168.XXX.XXX </server> </match>
集約サーバ設定(1) # ストリームを受け取って <source> type forward </source> # 適度にサンプリングして <match
api.**> type sampling_filter interval 10 remove_prefix api add_prefix sampled
集約サーバ設定(2) # サンプリングしたデータを集計して <match sampled.**> type datacounter unit minute count_key
vhost pattern1 aaa ^aaa.jp$ pattern2 bbb ^img.bbb.jp$ pattern3 ccc ^img.ccc.jp$ tag access </match>
集約サーバ設定(3) # 集計結果をGrowthForecastに投げる <match access> type growthforecast gfapi_url http://localhost:5125/api/ service
aaa section access_count name_keys sampled.access_unmatched_count,sampled.access_aaa_c ount,sampled.access_bbb_count,sampled.access_ccc_cou nt </match>
グラフ出来た
あっさり出来たすごい • 設定ファイルの行数少ない ◦ 送り元: 18 ◦ delegate: 28 •
MongoDBにつっこんだりすることなく、グラフ描 画まで終わる • pluginは tagomoris さんのものをふんだんに利 用した • というかブログに書いてあることをかいつまんで そのままやっただけ
負荷は? • 送り元サーバ ◦ ログはdaily約100万行 1台あたり 15 req/s くらい •
集約サーバ ◦ 送り元8台に対して1台 →今のところ全く問題無し
やってみた感想
手頃なログのグラフ化から始めると吉 • 既にあるログからスタート • グラフが出るとテンションが上がる(取り方が分 かる) • テンションが上がると他にも色々データが取りた くなる ◦
画像ストレージノードのレスポンスタイムにばらつきばあ るっぽいので突き止めたい
まとめ • rbenvを使うと導入お手軽(プラグイン追加とか 特に) • 簡単なデータ集計は既にあるプラグインを使う だけで色々出来る (tagomoris++) • GrowthForecastがグラフ化するのが楽すぎて
しびれる (kazeburo++) • 目に見える形でデータが出るとテンションが上 がる • グラフ化から始めて徐々に使い道を探っていく と吉ではないかと
というLTでしたがSoftware Designに もっと詳しく載ってました!