Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and...

45
WUNCA-33 Logging and Big Data หัวหน้าภาควิชาวิศวกรรมคอมพิวเตอร์ คณะวิศวกรรมศาสตร์ จุฬาลงกรณ์มหาวิทยาลัย [email protected] @natawutn http://natawutn.wordpress.com http://www.slideshare.net/natawutnupairoj ผศ.ดร.ณัฐวุฒิ หนูไพโรจน์

Transcript of Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and...

Page 1: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

WUNCA-33

Logging and Big Data

หวัหน้าภาควิชาวิศวกรรมคอมพิวเตอร์คณะวิศวกรรมศาสตร์จฬุาลงกรณ์มหาวิทยาลยั

[email protected]@natawutnhttp://natawutn.wordpress.comhttp://www.slideshare.net/natawutnupairoj

ผศ.ดร.ณัฐวุฒ ิหนูไพโรจน์

Page 2: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

เราจะเก็บ IT LOG ของ SERVER ไปท าไม?

• ตามข้อบงัคบัของพรบ.คอมพิวเตอร์

• ตรวจสอบปัญหาที่อาจจะเกิดขึน้

• ตรวจสอบด้านความปลอดภยั

• วิเคราะห์สถิติที่ส าคญั

Page 3: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

คุณสมบัตทิี่ส าคัญของระบบ LOG ขนาดใหญ่

• รองรับข้อมลูขนาดใหญ่

• รองรับการตรวจจบัข้อมลูแบบ Real-Time

• รองรับข้อมลูที่หลากหลายรูปแบบ

• รองรับการรวบรวมข้อมลูจากหลาย Server ที่อาจอยูต่า่งสถานที่

• มีความสามารถในการค้นหาข้อมลูได้อย่างรวดเร็ว

Page 4: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ข้อมูลที่ไม่สามารถประมวลผลได้เสร็จสิน้ ในเวลาที่เหมาะสม โดยใช้เคร่ืองเพียง 2-3 เคร่ือง

Page 5: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ตัวอย่างเล็กๆ IT LOG ของจุฬาลงกรณ์มหาวิทยาลัย

Users 40,000+Servers = 500+Wifi + NAT

Manual processes

Approx. traffic: 5,000 events / sec

Storage 90 days= 39,000,000,000 events (6.5TB)

Use Syslog + Graylog-2 (based on

ElasticSearch technology)

Page 6: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,
Page 7: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

คุณลักษณะของ BIG DATA

Source: IBM

Page 8: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

สถาปัตยกรรมของระบบต้นแบบ

Page 9: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ความต้องการเพิ่มเตมิ

• การจดัเก็บและบริหารของข้อมลู Log จากวิทยาเขตตา่งๆ

• จฬุาลงกรณ์มหาวิทยาลยั วิทยาเขตน่าน

• ศนูย์วิจยัจฬุาลงกรณ์มหาวิทยาลยั วิทยาเขตสระบรีุ

• การตรวจจบัปัญหาแบบ Real-Time

• การขยายที่จดัเก็บในราคาที่เหมาะสม

Page 10: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

สรุปความต้องการของ BIG DATA LOG SYSTEM

• รองรับการเก็บข้อมลูขนาดใหญ่ ที่มีเสถียรภาพ มีประสิทธิภาพ ในราคาสมเหตสุมผล

• รองรับการรวบรวมข้อมลูจากหลายแหง่ โดยไมต่กหลน่ อยา่งมีประสิทธิภาพ

• รองรับการสืบค้น และแสดงผลที่งา่ยตอ่การใช้งาน

• รองรับการประมวลผลตามกฎหมาย และการท างานทัว่ไป ทัง้ในรูปแบบ Batch และ/หรือ Real-Time

Page 11: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ARCHITECTURAL PATTERN #1BASIC ARCHITECTURE

รวบรวมข้อมลู จดัเก็บข้อมลูประมวลผลข้อมลู

สืบค้นข้อมลู

Page 12: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

• Opensource software framework โดยมีแนวความคิดจาก Google Search Engine Architecture

• เน้นการใช้ Commodity Hardware ราคาถกู แต ่Software ท่ีเก่ง เพื่อท าให้เกิด Reliability

• Map-Reduced ท าให้ง่ายตอ่การเขียนโปรแกรมท างานบน Cluster โดยไม่จ าเป็นต้องช านาญด้าน Parallel Processing

• มี Hadoop File System (HDFS) ในการจดัเก็บข้อมลูท่ี reliable ในราคาไมแ่พง

• ผู้ใช้: Yahoo!, Facebook, Amazon, eBay, American Airline, Apple, Google, HP, IBM, Microsoft, Netflix, New York Times, ฯลฯ

Page 13: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Rackaware

3 copy

Page 14: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ELASTICSEARCH

• ระบบ OpenSource ท่ีมีลกัษณะเป็นฐานข้อมลูผสม Search Engine

• ถกูออกแบบมาเพื่อรองรับการจดัการ Real-Time data

• รองรับการท า Scale-Out ในรูปแบบของ Cluster

• เป็นการแบง่ข้อมลูออกเป็นชิน้ๆ แตล่ะชิน้เรียกวา่ Shard

• การแบง่ Shard จะใช้ Timestamp ของ Log เป็นตวัแบง่

• 1 Shard สามารถมีหลาย Copy ได้ (Replication)

Page 15: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

# of shards = 1# of replicas = 1

# of shards = 2# of replicas = 1

Page 16: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

# of shards = 3# of replicas = 1

Page 17: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

# of shards = 3# of replicas = 2

Page 18: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,
Page 19: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ARCHITECTURAL PATTERN #2LAMBDA ARCHITECTURE

รวบรวมข้อมลู จดัเก็บข้อมลูประมวลผลข้อมลู

สืบค้นข้อมลู

รวบรวมข้อมลูประมวลผลข้อมลู

ตรวจจบัเง่ือนไข แจ้งเตือน

Speed Layer

Batch Layer Serving Layer

Page 20: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Python

Page 21: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

• ระบบงานประมวลผลโดยใช้หน่วยความจ าเป็นหลกั (In-Memory Data Processing) ของ UC Berkeley

• ขยาย MapReduce ให้รองรับ batch executions, interactive queries, และstream processing

• รองรับหลายภาษา ทัง้ Java, Python, Scala, และ R และมี analytic libraries (machine learning, graph processing)

• ได้รับความร่วมมือในการพฒันา และการสนบัสนนุจากคนทัว่โลก

• เร็วกวา่ Hadoop 10-100 เทา่

Page 22: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

DATA COLLECTOR (LOG SHIPPER)

• เคร่ืองมือในการดงึข้อมลูจาก Server ต้นทาง สง่มายงั Big Data ปลายทาง แบบ Real-Time

• มีประสทิธิภาพสงู ใช้เวลาในการเคลื่อนย้ายข้อมลูสัน้

• สามารถประมวลผล/ปรับเปลี่ยน In-Flight Data ได้

• มีลกัษณะเป็น Adapter / Plugin Architecture

• สามารถขยายระบบเพ่ือรองรับเคร่ืองต้นทางจ านวนมากได้

• รองรับการท างานแบบกระจาย

• Reliability และ Availability

Page 23: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: Sematext, “Top 5 Most Popular Log Shipper”,

http://blog.sematext.com/2014/10/06/top-5-most-popular-log-shippers/

Page 24: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

APACHE FLUME

• ระบบน าเข้าข้อมลูแบบ Opensource

• Distributed / Reliable / Scalable

Event

Page 25: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

APACHE FLUME OVERVIEW BY GETINDATA

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 26: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 27: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 28: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 29: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 30: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 31: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 32: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 33: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 34: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 35: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 36: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 37: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 38: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 39: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 40: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 41: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

Source: http://www.slideshare.net/getindata/apache-flume-37675297

Page 42: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

ตัวอย่างของการวิเคราะห์ LOG ที่ต้องอาศัย LAMBDA ARCHITECTURE

• การนบัจ านวนผู้ใช้งานแยกตามพืน้ที่ / เวลา

• การวิเคราะห์ Traffic Anomaly (เช่น SARIMA)

Page 43: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,
Page 44: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,
Page 45: Logging and Big Data - wunca.uni.net.thwunca.uni.net.th/wunca_regis/wunca33_doc/14/015_Logging and Big... · •มี Hadoop File System ... •ผู้ใช้: Yahoo!, Facebook,

บทสรุป

• การเก็บ Log ขนาดใหญ่ไม่ใช่เร่ืองยุง่ยากอีกตอ่ไป

• เคร่ืองมือมีหลายหลายและเป็น Opensource

• รูปแบบ Architecture มีความส าคญัตอ่การพฒันา

• ความเข้าใจในเชิงลกึมีความส าคญัตอ่การปรับแตง่ระบบ

• สามารถใช้เป็นพืน้ฐานในการตอ่ยอดในด้านงานวิจยั