SlideShare a Scribd company logo
1 of 16
Download to read offline
データ可視化、分析をする人に
「Elasticsearchにデータ入れて
おいて」と言われたら
2018/12/26(水)
Japan Elastic User Group #2
1
目次
■ 自己紹介
■ 宣伝
■ 今回の話のあらすじ
■ Before
■ 対処法
■ After
■ まとめ
2
自己紹介
■ 片野 祐(かたの ゆう)
■ Elasticを使い始めたきっかけ
– 機械学習を試したくて…5.xから利用
■ JapanElasticUserGroupの運営やってます
■ 第1回JapanElasticUserGroupでも喋ってました
– https://www.slideshare.net/YuKatano/jeug1lt
■ 12/21(金)のAdvent Calendar書いてました
– https://qiita.com/yukata_uno/items/669fb9b69e39d52c4e29
■ 先週にLTするのが決まりました
3
4
宣伝
@yukata_uno
適当にいろんなことをたまにつぶやくアカウント
Advent Calendarもこの名前
@jeug_manage
JapanElasticUserGroupの周知とかもろもろをするアカウント
Facebook Groupでイベントとか作成しているが、
こちらでも周知予定
フォローお願いします
イベントの告知したらリツイートお願いします
今回の話のあらすじ
■ とあるネットワーク機器からのストリーミングデー
タ(Streaming Telemetry)をLogstash経由でElasticsearch
に入れ、Kibanaで可視化、分析する
■ 役割分担
– Elasticsearchにデータを入れるところまで→他の人
– Kibanaでの可視化、分析→自分
■ 「とりあえずデータをElasticsearchに入れる」ように
頼んでしまうと、今回のようなことが起こります
– なぜならElasticsearchにデータは確かに入っているから
5
6
Before-1
7
Before-1
field名が長すぎて省略されていて、何かわからない
“update.Sysdb.interface.counter.eth.slice.phy.1.intfCounterDir
.Ethernet3.current” まで共通のfield名
8
長いField名の正体
{
"@version": "1",
"dataset": "10.44.160.88:6042",
"@timestamp": "2018-12-21T06:55:43.307Z",
"timestamp": 1545375095319,
"update": {
"Sysdb": {
"interface": {
"counter": {
"eth": {
"slice": {
"phy": {
"1": {
"intfCounterDir": {
"Ethernet3": {
"intfCounter": {
"current": {
"rates": {
"outPktsRate": 0.03442882344690907,
"statsUpdateTime": 280228.978311996,
"inBitsRate": 0,
"inPktsRate": 0,
"outBitsRate": 45.99690812507048
},
"statistics": {
"outMulticastPkts": 0,
"outDiscards": 0,
"outBroadcastPkts": 0,
"inMulticastPkts": 0,
"outOctets": 1559279,
"inUcastPkts": 0,
"inBroadcastPkts": 0,
"inDiscards": 0,
"outErrors": 0,
"inErrors": 0,
"outUcastPkts": 9337,
"inOctets": 0,
"lastUpdate": 280228.97986983
}
}
}
}
}
}
}
}
}
}
}
}
}
}
JSONの入れ子構造によって生み出されたField名
9
Before-2
10
Before-2
Field名が長すぎて見切れてしまい、どうしようもない
いちいち手入力するのも面倒
11
対処法:filter mutate rename
filter {
mutate {
rename => {
"[update][Sysdb][interface][counter][eth][slice][phy][1][intfCounterDir][Ethernet3][intfCounter][current]" => "intf" }
}
}
renameは主に
filter {
mutate {
# Renames the 'HOSTORIP' field to 'client_ip'
rename => { "HOSTORIP" => "client_ip" }
}
}
のようにfield名の変換に使うが、今回のように共通したfield名の置換も
一行で書ける。
参考
■ https://www.elastic.co/guide/en/logstash/current/plugin
s-filters-mutate.html#plugins-filters-mutate-rename
■ https://www.elastic.co/guide/en/logstash/current/event-
dependent-configuration.html#logstash-config-field-
references
■ https://www.elastic.co/guide/en/logstash/current/field-
references-deepdive.html
12
13
After-1
スッキリ
スッキリ
14
After-2
バッチリfield名が見える
まとめ
■ 可視化、分析を考えて、データの格納をする
– どの立ち位置のエンジニアにも言えること
– ただデータを流すだけではなく、データの構造を考えて
データを流すべし
■ 「Elasticsearchにデータ入れておいて」→「 (分析し
やすい形で)Elasticsearchにデータ入れておいて(。
あとは取得するfieldが増えても修正するところがで
きるだけ少ないように、データを吐く側でどうにか
できるところはどうにかしておいて)」
■ 世の中を流れるデータがきれいなものでありますよ
うに
15
おわり
16

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Jeug#2 lt