Elastic Stackで始める アプリケーション監視 Jun Ohtani, Community Advocate 2019/10/04

about • Me, Jun Ohtani / Community Engineer ‒ lucene-gosenコミッター ‒ データ分析基盤構築入門 共著 ‒ http://blog.johtani.info • Elastic, founded in 2012 ‒ Products: Elasticsearch, Logstash, Kibana, Beats Elastic APM, Elastic Cloud, Swiftype Professional services: Support & development subscriptions Trainings, Consulting, SaaS 2

Observability 3 https://www.elastic.co/jp/blog/observability-with-the-elastic-stack

Kibana、ログだけじゃないし 監視系の話もできないとなぁ

5

これだ! (インスパイアされてみました)

アジェンダ • 監視とは? • Elastic Stackとは? • 様々な観点からのアプリケーションの監視 • さらに色々試してみるには? 7

監視とは?

Subtitle sentence case (Open Sans 18pt) 9

Subtitle sentence case (Open Sans 18pt) 10

マイクロサービス??? 11

Elastic Stackとは?

Application Search Site Search Metrics APM Enterprise Search Logging Business Analytics Security Analytics Future ソリューション Kibana 可視化、管理 Elasticsearch 保存、検索、分析 Elastic Stack Beats SaaS Elastic Cloud 13 インジェスト Logstash Self Managed Elastic Cloud Enterprise Standalone デプロイ

デモサイト GCEインスタンス 14 GCEインスタンス APM Ruby Heartbeat Filebeat Filebeat Metricbeat Metricbeat Packetbeat Packetbeat Auditbeat Auditbeat

デモサイト https://www.johtani.dev 15

アプリケーションの 監視ポイント

監視ポイント • 外形監視 • メトリック(メトリクス) • サーバー、アプリケーション • ログ • アプリケーションのリリースタイミング • 分散トレーシング 17

Heartbeat Lightweight Shipper for Uptime Monitoring

Uptime UI Dedicated Uptime Monitoring UI for Kibana

Metricbeat lots of modules

Metricbeat モジュール ● ● ● ● ● ● ● ● ● ● ● ● ● ● 21 Aerospike module Apache module aws module Ceph module Couchbase module couchdb module Docker module Dropwizard module Elasticsearch module envoyproxy module Etcd module Golang module Graphite module HAProxy module ● ● ● ● ● ● ● ● ● ● ● ● ● HTTP module Jolokia module Kafka module Kibana module Kubernetes module kvm module Logstash module Memcached module MongoDB module mssql module Munin module MySQL module Nats module ● ● ● ● ● ● ● ● ● ● ● Nginx module PHP_FPM module PostgreSQL module Prometheus module RabbitMQ module Redis module System module traefik module uwsgi module vSphere module Windows module ZooKeeper module

Filebeat tail log from file

Filebeat many modules

Filebeat modules - v7.0.0 • Apache module • Auditd module • Elasticsearch module • haproxy module • Icinga module • IIS module • Iptables module • Kafka module • PostgreSQL module • Kibana module • Redis module • Logstash module • Santa module • MongoDB module • Suricata module • MySQL module • System module • Nginx module • Traefik module • Osquery module • Zeek (Bro) Module

winlogbeat Welcome to 1998

winlogbeat Now

Packetbeat Capture the Packet

Packetbeat Capture the Packet

アプリケーションのリリースタイミング • バグフィックスリリース • 新機能リリース • 新サービス開始 • サーバー増強 29

Time Series Visual Builder Annotations on Visualization

分散トレーシング • マイクロサービス • 1つのリクエストに対して複数のプロセスが関係 • アプリケーションパフォーマンスモニタリングの1つ 31

32

サポート言語 • Node.js • Python • Ruby • Go • Java • .NET • RUM - Real User Monitoring JavaScript Agent 33

Elastic APM 34

Distributed Tracing Beta | Basic (free) 全ての計測されたサービスを見るための 統合されたビュー サブコンテキスト内のトレースに遷移 OpenTracing 互換

Deployment Dashboards OSS Beats App - Basic (free) Logs Metrics Packets … Logstash Datastore JMX OSS APM Agents 36 OSS APM Server Elasticsearch Kibana

APM Ruby Agent Framework Support • Ruby on Rails >= 4.x • Sinatra and Rack compatible frameworks 37

APM Ruby Agent with Rails How to use with Rails • Add elastic-apm gem in Gemfile • Create elastic_apm.yml file under config dir • See reference for other configurations https://www.elastic.co/guide/en/apm/agent/ruby/current/configuration.html 38

そのほかの便利な機能 • Infra UI • Logs UI • Machine Learning • Alerting 39

Infrastructure Solution Beta | Basic (free) インフラオペレーター向けに特化 1000を超えるインフラの構成を俯瞰 Kubernetes、Docker のネイティブサ ポート メトリック、ログ、APM ビューへの ドリル・ダウン アドホックおよび構造化検索

Logs Solution Beta | Basic (free) ライブでログのトラブルシューティング を助ける軽量なログビューアー コンソールのような表示 (tail -fのような)ライブ・ログ・ストリー ミング 履歴ログの無限スクロール アドホックおよび構造化検索

さらに活用するには?

46

47

参考サイト • ユースケース • https://www.elastic.co/use-cases • Discuss(Webフォーラム) • https://discuss.elastic.co • Elastic{ON}のビデオと資料 • https://www.elastic.co/elasticon/videos • サポートメニュー • https://www.elastic.co/subscriptions 48

参考文献 • Elasticsearch - The Definitive guide ‒ http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html • 書籍(日本語) ‒ データ分析基盤構築入門 ‒ Elasticsearch実践ガイド 49

参考文献 • 入門 監視 ―モダンなモニタリングのためのデザインパターン Mike Julian 著、松浦 隼人 訳 https://www.oreilly.co.jp/books/9784873118642/ 50

Elastic Stackのセキュリ ティ:データを安全に保つた めのベストプラクティス Kosho Owa, Solution Architect, Elastic 2019年10月31日(木) 12:00PM | ウェビナー

Thank you! ● ● ● ● Sample: https://github.com/johtani/monitoring-ruby-app Web : https://www.elastic.co/jp/ Forums : https://discuss.elastic.co/ Twitter : @johtani