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
Hiroki Takeda
September 13, 2016
Technology
110
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
93
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
95
Data Shipper Platform Beats
rhumie
0
190
Other Decks in Technology
See All in Technology
レガシーコードに対する loop engineering的なAI開発プロセス導入について
kubell_hr
0
250
You Have Agency(サンキュー、Ruby)
snoozer05
PRO
5
680
令和の今、あらためて IAM を考える。アクセスキーを「無くせない現実」との向き合い方
kazzpapa3
0
220
E2Eってつらくないですか?E2Eの管理コストを下げる手段とその実践
akaboshinit
6
3k
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
150
cdkd (CDK Direct)
gotok365
3
240
攻撃 3 時間 vs 復旧 10 時間。アクセスキー流出の非対称性を体感するために CTF を作った話
kazzpapa3
1
150
2026 Apache Flink Community Checkpoint
rmetzger
0
180
Strands Decider 2BでAWSアップデートの目利きをしてみた
sato4mi
1
120
生成AI時代のIAMのマニアックな話
takuros
6
2.3k
Don't write the architecture only in the prompt.
neohsu
0
310
複雑な業務システムを高速でつくるため、チーム全員をつくれる人へ
ayakurabuchi
0
130
Featured
See All Featured
Building an army of robots
kneath
307
47k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.3k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
How GitHub (no longer) Works
holman
316
150k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
570
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
670
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