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
ログモニタリングツールを自作した話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Hiroki Takeda
September 13, 2016
Technology
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ログモニタリングツールを自作した話
社内LT用
Hiroki Takeda
September 13, 2016
More Decks by Hiroki Takeda
See All by Hiroki Takeda
書籍「絵で見てわかるWeb APIの仕組み」のご紹介
rhumie
0
85
PlaywrightによるE2Eテスト入門 / Introduction to E2E Testing with Playwright
rhumie
7
5.4k
未知の未知を既知の未知へ / Unknown unknowns to Known unknowns
rhumie
5
4.6k
ServeMuxの競合検知と性能
rhumie
1
150
エンジニアを目指す君たちはどう生きるか ~ソフトウェアアーキテクトのすゝめ~
rhumie
41
23k
An Encouragement of Flutter Golden Test
rhumie
1
1.1k
AWSマネージドサービスをフル活用したヘルスケアIoTプラットフォーム基盤
rhumie
0
88
Data Shipper Platform Beats
rhumie
0
180
Other Decks in Technology
See All in Technology
アカウント統制の健康診断
kenichinakamura
1
210
DevelopersIO2026 -バックアップは“消されないこと”が9割-
yoshida0129
0
420
キヨさん、67歳。AIコーディングエージェントに挑む
happysamurai294
0
110
[FECONF-2026] 신대륙을 향한 카카오페이증권 프론트엔드 항해기 (이주승)
l1ghthouse
0
240
LLMの知識とAIエージェント
happysamurai294
0
110
How we choose session proposals
kawaguti
PRO
1
180
(swiftc) NonCopyableとライフタイム修飾子
teamhimeh
0
140
CSS2026:OWS研究会・招待講演「世界観を、実装する」
atsush1_sada
2
340
AI駆動開発における開発環境のセキュリティの考え方
yamahiro
2
650
AWS DevOps Agentはどこまで任せられるか 〜機能の現在地と、機能拡張の実践〜
nyankotaro
0
260
クラウドサインを止めずに Nuxt へ 次の10年のために先に決めたこと
bengo4com
1
160
小規模OSSモデルは サイバーセキュリティ業務に どこまで使えるか
bbrbbq
0
300
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Producing Creativity
orderedlist
PRO
348
41k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
2
950
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Designing for Performance
lara
612
70k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
850
Into the Great Unknown - MozCon
thekraken
41
2.8k
Utilizing Notion as your number one productivity tool
mfonobong
4
630
GraphQLとの向き合い方2022年版
quramy
50
15k
We Are The Robots
honzajavorek
0
410
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Transcript
ログモニタリングツール を自作した話 Hiroki Takeda
各種サーバのログを一元的に管理し、可視化するブラウザ ベースのログモニタリングツール つくったもの 2
モチベーション • アプリ実行環境をマネージドサービスとして提供するため 利用者にSSHでログイン等はさせない世界観 ⇒利用者が各種ログを管理・閲覧できる仕組みが必要 3 ①サーバにSSH $ view /var/log/xxxx.log
②viewコマンド等でログを閲覧 オンプレの世界観 ①ブラウザからログを 選択するだけ PaaSの世界観
• シンプルかつオープンをコンセプト – データストアはelasticsearch – ログ収集エージェントはbeatsシリーズのfilebeat – REST APIはSpark Framework(Java)をベースに構築
– 画面はRiot.jsをベースに構築 アーキテクチャ 4 Client View HTTPS Websocket API Server REST API Data Store HTTPS HTTPS Log Agent
Elasticsearch構成 • 物理構成 – クラスタはプロジェクト単位 • 論理構成 – インデックス(RDBのデータベース相当)はログ収集対象の 各サーバ毎、年月日単位で作成
– タイプ(RDBのデーブル相当)はログファイル単位 – ドキュメント(RDBの行相当)はログファイルの1行単位 5 Elasticsearch インデックス =サーバ名_年月日 タイプ =ログの種類 ドキュメント =ログ1行 … …
特徴・機能 • 認証・認可(LDAP) • 多様なログ検索 – 文字列指定検索 – 日付・時刻指定検索 –
複数ログ同時検索 • ファイルダウンロード • リアルタイムログ出力(tail –fコマンド相当) • マテリアルデザイン・レスポンシブデザイン 6
Demo 7
裏話というか細かい話(1/2) • リアルタイムのログ出力では通信コストを低くし、リアル タイム性を向上させるためWebsocketを利用 ⇒ Client⇔APIサーバは双方向通信 ⇒ ElasticsearchがWebsocket対応していないため、 APIサーバ⇔Elasticsearch間は別スレッドでポーリング •
Elasticsearchのindexのサフィックス日付はUTC時刻で 決定されるため、日付検索で一部のログが引っかからない ⇒ 例えば日本時間の2016/8/10の03:00に出力されたログは、 xxxx-2016.08.10ではなくxxx-2016.08.09のインデックスに格納される ⇒ 日付指定検索時に指定された日付のみでインデックスを絞るとダメ ⇒ タイムゾーンオフセットを元に指定日付の前or後1日のインデックスも 検索対象に含める 8
裏話というか細かい話(2/2) • elasticsearchの@timestampフィールドはミリ秒まで しか保持できないため、時系列表示が完全に担保できない ⇒ ログファイル自体にナノ秒まで保持させ、logstashでパースして elasticsearchに食わせるか? ⇒ logstash使いたくないし、そもそもログ自体にナノ秒を保持できない ケースもある
⇒ filebeatのoffsetを利用 • ファイル行番号表示を実現しようとするとパフォーマンス が大幅に劣化する ⇒ filebeatではログデータの行番号は連携できない仕様 ⇒ 元ファイル通りに行番号を表示しようとすると1ファイル分のドキュメント を総なめして、ドキュメントIDと行番号の紐付きをキャッシュしておく 必要がある(条件検索で一部のログデータのみがヒットする場合も、連番 ではなく元ファイルの行番号を表示したいため) ⇒ ログが100万行とかあるといろいろキツイ ⇒ あきらめ(とりあえずoffsetを表示) 9
今後やりたいこと • オーケストレーションの実現 – 対象サーバ、ファイルパス等を入力して画面をポチると エージェント(filebeat)のインストール、設定が自動で実行 • エージェントレスな世界の実現 • ログ分析用のビュー
どなたか知見・アドバイスを・・・ 10