SlideShare ist ein Scribd-Unternehmen logo
1 von 30
GTA PHP
Dec 22, 2015
Peter Meth
• Organizer of:
‣ TrueNorth PHP
‣ DevOpsDays
‣ GTA PHP Meetup
‣ DevOps Toronto Meetup
• Find me
‣ in Acton, Ontario
‣ on Twitter @devopsmeth
‣ on Meetup
‣ on LinkedIn
‣ email pmeth@delvia.com
the DevOps Company
What is DevOps?
DevOps CALMS
• CULTURE
• AUTOMATION
• LEAN
• MEASUREMENT
• SHARING
DevOps CALMS
• CULTURE
• AUTOMATION
• LEAN
• MEASUREMENT
• SHARING
Elk (modified) by Alexander Mostov http://bit.ly/1Twjcjl License: CC BY-NC-SA 4.0
Elk (modified) by Alexander Mostov http://bit.ly/1Twjcjl License: CC BY-NC-SA 4.0
Logging in Finnish Lapland by Greanpeace Finland http://bit.ly/1Twjcjl License: CC BY 2.0
A bit about Logs
195.154.188.29 - - [02/Dec/2015:16:23:38 -0500] "POST
/ab.asp HTTP/1.1" 404 1231 "http://example.com/11m.php"
"Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1)"
157.55.39.99 - - [02/Dec/2015:16:35:04 -0500] "GET
/robots.txt HTTP/1.1" 200 2118 "-" "Mozilla/5.0
(compatible; bingbot/2.0;
+http://www.bing.com/bingbot.htm)”
[Wed Dec 02 16:52:08 2015] [error] [client
195.154.188.224] File does not exist: /var/www/ab.asp,
referer: http://example.com/11m.php
[Wed Dec 02 16:52:08 2015] [error] [client
195.154.188.224] File does not exist:
/var/www/robots.txt
Apache Access Logs
Apache Error Logs
MySQL Logs
Dec 2 17:09:01 ip-123-45-6-78 CRON[11785]:
pam_unix(cron:session): session opened for user root by (uid=0)
Dec 2 17:09:06 ip-123-45-6-78 CRON[11785]:
pam_unix(cron:session): session closed for user root
Dec 2 17:10:01 ip-123-45-6-78 CRON[11822]:
pam_unix(cron:session): session opened for user root by (uid=0)
Dec 2 17:10:08 ip-123-45-6-78 CRON[11822]:
pam_unix(cron:session): session closed for user root
Ubuntu Auth Logs
Application Logs
• There really are no standards
• Luckily there is usually some sort of timestamp
???? ????? ?? ?????
???? ????? ?? ?????
Enter ELK Stack
• Easy to install a simple stack
‣ Less than 1 hour using Digital Ocean blog post
• Made up of 3 (really 4) separate components
‣ Elasticsearch
‣ Logstash
‣ Kibana
‣ Log ship agent (rsyslog, logstash forwarder, filebeat)
Logger’s Playday Parade by John Lloyd https://flic.kr/p/34cyYD License: CC BY 2.0
All your logs are belong to us.
Logstash
Logstash
• input → filter → output workflow
• move logs from any server using many different
methods
• normalize timestamps
• powerful syntax for transformations, additions, tags
• outputs directly into Elastic Search
Defining Inputs
input {
lumberjack {
port => 5043
type => "logs"
ssl_certificate => “/path/file.crt”
ssl_key => "/path/file.key"
}
}
/etc/logstash/conf.d/01-lumberjack-input.conf
input {
file {
path => [“/path/to.log"]
type => "apache-access"
}
}
Defining Filters
filter {
if [type] == "apache-access" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
add_field => [ "received_from", "%{host}" ]
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
}
/etc/logstash/conf.d/10-apache-access.conf
Defining Outputs
output {
elasticsearch { hosts => ["localhost:9200"] }
stdout { codec => rubydebug }
}
/etc/logstash/conf.d/30-output.conf
logstash-forwarder
"network": {
"servers": [ "logstash_ip:5043" ],
"ssl ca": “/path/file.crt",
"timeout": 15
},
"files": [
{
"paths": [ “/var/log/file.log” ],
"fields": { "type": "some-type" }
}
]
/etc/logstash-forwarder.conf
Note: the logstash-forwarder project has been replaced by filebeat
Elastic Search
bands3 by DaveBleasdale https://flic.kr/p/Bn2yw License: CC BY 2.0
Elastic Search
• makes log files easily searchable
• blazing fast
• scalable
• maybe you’re already using it for Dev
• lots of power, but you don’t need to tweak much for
basic ELK stack
G-BNIVE panel by Andy / Andrew Fogg https://flic.kr/p/5RSJp License: CC BY 2.0
Kibana
Kibana
• Easily search for keywords in logfiles
• Visualize your data events over time
• Drill-down into individual events
• Create dashboards
• Share dashboards
Live Demo
(aka Crash n Burn Time)
Benefits / Uses
• ELK components can scale independently
• Visualize traffic patterns & user profiles
• Root-cause analysis
• Graph any arbitrary data you want to output from your
applications
• Store log files in a central location & get them off the
individual servers
• Bring non-technical people into the conversation
Further Resources
• Elastic website
https://www.elastic.co/webinars/introduction-elk-stack
• Digital Ocean tutorials (search for ELK)
https://www.digitalocean.com/community/tutorials
• Digital Ocean one-click-apps
https://www.digitalocean.com/features/one-click-apps/elk/
• The Delvia team is here to help
pmeth@delvia.com
Questions
(hopefully I have answers)
Contact me
Peter Meth
pmeth@delvia.com
devopsmeth
416-677-6384
www.delvia.com

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Kürzlich hochgeladen (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 
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...Applitools
 
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 WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
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
 

Centralized logging with the ELK Stack

  • 2. Peter Meth • Organizer of: ‣ TrueNorth PHP ‣ DevOpsDays ‣ GTA PHP Meetup ‣ DevOps Toronto Meetup • Find me ‣ in Acton, Ontario ‣ on Twitter @devopsmeth ‣ on Meetup ‣ on LinkedIn ‣ email pmeth@delvia.com
  • 5. DevOps CALMS • CULTURE • AUTOMATION • LEAN • MEASUREMENT • SHARING
  • 6. DevOps CALMS • CULTURE • AUTOMATION • LEAN • MEASUREMENT • SHARING
  • 7. Elk (modified) by Alexander Mostov http://bit.ly/1Twjcjl License: CC BY-NC-SA 4.0
  • 8. Elk (modified) by Alexander Mostov http://bit.ly/1Twjcjl License: CC BY-NC-SA 4.0
  • 9. Logging in Finnish Lapland by Greanpeace Finland http://bit.ly/1Twjcjl License: CC BY 2.0 A bit about Logs
  • 10. 195.154.188.29 - - [02/Dec/2015:16:23:38 -0500] "POST /ab.asp HTTP/1.1" 404 1231 "http://example.com/11m.php" "Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1)" 157.55.39.99 - - [02/Dec/2015:16:35:04 -0500] "GET /robots.txt HTTP/1.1" 200 2118 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)” [Wed Dec 02 16:52:08 2015] [error] [client 195.154.188.224] File does not exist: /var/www/ab.asp, referer: http://example.com/11m.php [Wed Dec 02 16:52:08 2015] [error] [client 195.154.188.224] File does not exist: /var/www/robots.txt Apache Access Logs Apache Error Logs
  • 12. Dec 2 17:09:01 ip-123-45-6-78 CRON[11785]: pam_unix(cron:session): session opened for user root by (uid=0) Dec 2 17:09:06 ip-123-45-6-78 CRON[11785]: pam_unix(cron:session): session closed for user root Dec 2 17:10:01 ip-123-45-6-78 CRON[11822]: pam_unix(cron:session): session opened for user root by (uid=0) Dec 2 17:10:08 ip-123-45-6-78 CRON[11822]: pam_unix(cron:session): session closed for user root Ubuntu Auth Logs
  • 13. Application Logs • There really are no standards • Luckily there is usually some sort of timestamp ???? ????? ?? ????? ???? ????? ?? ?????
  • 14. Enter ELK Stack • Easy to install a simple stack ‣ Less than 1 hour using Digital Ocean blog post • Made up of 3 (really 4) separate components ‣ Elasticsearch ‣ Logstash ‣ Kibana ‣ Log ship agent (rsyslog, logstash forwarder, filebeat)
  • 15. Logger’s Playday Parade by John Lloyd https://flic.kr/p/34cyYD License: CC BY 2.0 All your logs are belong to us. Logstash
  • 16. Logstash • input → filter → output workflow • move logs from any server using many different methods • normalize timestamps • powerful syntax for transformations, additions, tags • outputs directly into Elastic Search
  • 17. Defining Inputs input { lumberjack { port => 5043 type => "logs" ssl_certificate => “/path/file.crt” ssl_key => "/path/file.key" } } /etc/logstash/conf.d/01-lumberjack-input.conf input { file { path => [“/path/to.log"] type => "apache-access" } }
  • 18. Defining Filters filter { if [type] == "apache-access" { grok { match => { "message" => "%{COMBINEDAPACHELOG}" } add_field => [ "received_from", "%{host}" ] } date { match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ] } } } /etc/logstash/conf.d/10-apache-access.conf
  • 19. Defining Outputs output { elasticsearch { hosts => ["localhost:9200"] } stdout { codec => rubydebug } } /etc/logstash/conf.d/30-output.conf
  • 20. logstash-forwarder "network": { "servers": [ "logstash_ip:5043" ], "ssl ca": “/path/file.crt", "timeout": 15 }, "files": [ { "paths": [ “/var/log/file.log” ], "fields": { "type": "some-type" } } ] /etc/logstash-forwarder.conf Note: the logstash-forwarder project has been replaced by filebeat
  • 21. Elastic Search bands3 by DaveBleasdale https://flic.kr/p/Bn2yw License: CC BY 2.0
  • 22. Elastic Search • makes log files easily searchable • blazing fast • scalable • maybe you’re already using it for Dev • lots of power, but you don’t need to tweak much for basic ELK stack
  • 23. G-BNIVE panel by Andy / Andrew Fogg https://flic.kr/p/5RSJp License: CC BY 2.0 Kibana
  • 24. Kibana • Easily search for keywords in logfiles • Visualize your data events over time • Drill-down into individual events • Create dashboards • Share dashboards
  • 25.
  • 26. Live Demo (aka Crash n Burn Time)
  • 27. Benefits / Uses • ELK components can scale independently • Visualize traffic patterns & user profiles • Root-cause analysis • Graph any arbitrary data you want to output from your applications • Store log files in a central location & get them off the individual servers • Bring non-technical people into the conversation
  • 28. Further Resources • Elastic website https://www.elastic.co/webinars/introduction-elk-stack • Digital Ocean tutorials (search for ELK) https://www.digitalocean.com/community/tutorials • Digital Ocean one-click-apps https://www.digitalocean.com/features/one-click-apps/elk/ • The Delvia team is here to help pmeth@delvia.com

Hinweis der Redaktion

  1. Where do logs come from? (developers whims) So they don’t start their lives as something valuable, but ELK can turn them into that