SlideShare a Scribd company logo
1 of 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

More Related Content

Recently uploaded

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Featured

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
 

Featured (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

Editor's Notes

  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