SlideShare a Scribd company logo
Managing the logs of your (Rails) applications Lennart Koopmann,  RailsWayCon 2011 www.lennartkoopmann.net / @_lennart
About me 23 years old Living in Hamburg Rails developer at XING AG Developer of Graylog2
What is this log management stuff? Even grepping over flat files can be log management.
Log Management Maturity Scale Log management has different levels – Raffael Marty set up a scale for that.
Level 0 Do not collect logs at all.
Level 1 Collect logs. Mostly simple log files from email or HTTP servers.
Level 2 Use the logs for forensics and troubleshooting. Why was that email not sent out? Why was that HTTP 500 thrown?
Level 3 Save searches. The most basic case would be to save a grep command you used.
Level 4 Share searches. Store that search command somewhere so co-workers can find and use it to solve the same problem.
Level 5 Reporting.
Level 6 Alerting. Automate some of your troubleshooting tasks. Be warned automatically instead of waiting for a user to complain.
Level 7 Collect more logs! We may need more sources for some use cases – Like multi-line application logs, firewall logs or even physical access logs.
Level 8 Correlation. Manual analysis of all this new data may take too long – Correlate different sources.
Level 9 Visual analysis.
Next levels Pattern detection, interactive visualization, dynamic queries, anomaly detection, more sharing.
Collecting logs Two different types.
Type 1 Logs automatically generated from a service. For example apache2.log or mail.log – Usually huge amount of structured, but raw data. jira.graylog2.org:80 x.x.x.x - - [29/May/2011:01:47:38 +0200] "GET /browse/WEBINTERFACE-21?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel HTTP/1.1" 200 7639 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
Type 2 Logs sent directly from within your application. Triggered for example by a log.error() call or an Exception catcher. - Possible to send structured via for example GELF 2011-05-29 18:55:51 +0200 [payment] Could not validate credit card: Got HTTP 404 from example.org
How to send your logs Don't store the logs in flat files. Send them somewhere to get more value out of them.
Syslog Syslog adapters for Rails are available and work pretty good.
GELF Graylog extended log format – Let's you structure your logs. Also check out structured syslog. Ruby library, Rack exception notifier and Ruby logger available. ( www.graylog2.org )
{ ' message ':'[pay] ZOMG credit card invalid', ' full_message ':'Stacktrace.Some env vars', ' host ':'www19', ' file ':'/var/www/app.rb', ' line ':2638, ' level ':1, ' _something ':'foo', ' _something_else ':'bar' }
AMQP Guaranteed and ordered delivery. Very flexible. Easily subscribe to the flow. Use routing keys to structure origin of the logs. Hell yeah, use this if you have an AMQP bus available. (or build one) Check out  https://github.com/paukul/amqp_logging
Throw the messages out of your app like a hot potato Loose coupling! Your logs should always leave the application without interfering it! Prefer UDP over TCP, decouple AMQP log transports. Catch all exceptions and get back into the app flow.
Add more value to your logs For example pre-generate geo information for IP addresses or integrate the time_bandits gem.
https://github.com/skaes/time_bandits Completed in 680.378ms (View: 28.488, DB: 5.111(2,0), MC: 5.382(6r,0m), GC: 120.100(1), HP: 0(2000000,546468,18682541,934967)) | 200 OK [ http://127.0.0.1/jobs/info ] Can generate a deep insight view of your application performance when used with LogJam:  https://github.com/alpinegizmo/logjam
Where to send your logs There are a lot of tools available.
Hosted services: Loggly www.loggly.com Dynamic pricing based on your usage Free for 200MB/day with 1 week retention time UDP/TCP/HTTP API as input for syslog
 
 
Hosted services: Splunk www.splunk.com Two license types: Free / Enterprise Supports any raw input
Two more hosted services: www.papertrailapp.com www.logentries.com
Open source tools: Logstash www.logstash.net Collect, parse and store logs for later use Input -> Filter -> Output Plays very well with Graylog2
Logstash inputs For example: AMQP, file, redis, stdin, syslog, tcp, stomp, twitter
Logstash filters For example: date, field, grep, grok, multiline
Logstash outputs For example: amqp, elasticsearch, gelf, mongodb, redis, stdout, tcp, websocket
 
Open source tools: Graylog2 www.graylog2.org Accepts syslog (TCP/UDP) and GELF (+ AMQP) Rails web interface for filtering, analytics, alerting, reporting, … Stores in MongoDB
 
 
 
 
 
Log management use case: API consumer monitoring Something different from the usual alerting, monitoring and reporting.
Pre-processor script (or Logstash) parses raw access log (possibly via AMQP), combines multi line log messages of API engine and extracts value.
oauth_consumer_key, severity, http_status_code, processed (controller#action)
Pre-processor sends the extracted value including the raw message to Graylog2.
n.notify { :severity => 4, :short_message => “UsersController#show [500]”, :full_message => full_msg, :_oauth_consumer_key => “foo”, :_processed => “UsersController#show”, :_http_status_code => 500, ... ... }
Now use Graylog2 and the MongoDB shell to answer questions like...
What consumers are still using the deprecated find user by email call?
What errors are caused by the iPhone application?
Which applications keep causing errors?
Which consumers are inactive?
How many calls are done by the iPhone application and how many were it a month ago?
Extract everything you might need from the message in a structured format you can easily parse and query later. You already have all the data you need!
Q & A @_lennart www.lennartkoopmann.net

More Related Content

What's hot

Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to KafkaApache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Mark Bittmann
 
0.5mln packets per second with Erlang
0.5mln packets per second with Erlang0.5mln packets per second with Erlang
0.5mln packets per second with Erlang
Maxim Kharchenko
 
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
Pôle Systematic Paris-Region
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8
Dori Waldman
 
Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka
Dori Waldman
 
Sync with async
Sync with  asyncSync with  async
Sync with async
prabathsl
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 Basic
Flink Forward
 
Tcp repair
Tcp repairTcp repair
Tcp repair
Pavel Emelyanov
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for Smalltalk
ESUG
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
Apache Traffic Server
 
Nmap 9 truth "Nothing to say any more"
Nmap 9 truth "Nothing to say  any more"Nmap 9 truth "Nothing to say  any more"
Nmap 9 truth "Nothing to say any more"
abend_cve_9999_0001
 
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Brian Brazil
 
Naresh
NareshNaresh
Naresh
Naresh
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
Peter Lawrey
 
Performance
PerformancePerformance
Performance
Christophe Marchal
 
Storing 16 Bytes at Scale
Storing 16 Bytes at ScaleStoring 16 Bytes at Scale
Storing 16 Bytes at Scale
Fabian Reinartz
 
Our way of systems monitoring in application development
Our way of systems monitoring in application developmentOur way of systems monitoring in application development
Our way of systems monitoring in application development
OCoderFest
 

What's hot (20)

Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to KafkaApache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
Apache Kafka DC Meetup: Replicating DB Binary Logs to Kafka
 
0.5mln packets per second with Erlang
0.5mln packets per second with Erlang0.5mln packets per second with Erlang
0.5mln packets per second with Erlang
 
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
PyParis2017 / Tutorial transcript - Function-as-a-service : a pythonic perspe...
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8
 
Spark stream - Kafka
Spark stream - Kafka Spark stream - Kafka
Spark stream - Kafka
 
Sync with async
Sync with  asyncSync with  async
Sync with async
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 Basic
 
Tcp repair
Tcp repairTcp repair
Tcp repair
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for Smalltalk
 
Django debugging
Django debuggingDjango debugging
Django debugging
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Nmap 9 truth "Nothing to say any more"
Nmap 9 truth "Nothing to say  any more"Nmap 9 truth "Nothing to say  any more"
Nmap 9 truth "Nothing to say any more"
 
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
 
Naresh
NareshNaresh
Naresh
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
 
Install
InstallInstall
Install
 
Performance
PerformancePerformance
Performance
 
Storing 16 Bytes at Scale
Storing 16 Bytes at ScaleStoring 16 Bytes at Scale
Storing 16 Bytes at Scale
 
Our way of systems monitoring in application development
Our way of systems monitoring in application developmentOur way of systems monitoring in application development
Our way of systems monitoring in application development
 
Nmap
NmapNmap
Nmap
 

Viewers also liked

Debugging rails
Debugging railsDebugging rails
Debugging rails
Michael Denomy
 
MongoDB Operational Best Practices (mongosf2012)
MongoDB Operational Best Practices (mongosf2012)MongoDB Operational Best Practices (mongosf2012)
MongoDB Operational Best Practices (mongosf2012)
Scott Hernandez
 
Petty Cash Management - How To Manage Logs and Transactions
Petty Cash Management - How To Manage Logs and TransactionsPetty Cash Management - How To Manage Logs and Transactions
Petty Cash Management - How To Manage Logs and Transactions
David Olson
 
"Grand Challenges" of Log Management
"Grand Challenges" of Log Management"Grand Challenges" of Log Management
"Grand Challenges" of Log Management
Anton Chuvakin
 
Elastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & KibanaElastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & Kibana
SpringPeople
 
Log Files
Log FilesLog Files
Gaining Operational Insights out of Your Logs
Gaining Operational Insights out of Your LogsGaining Operational Insights out of Your Logs
Gaining Operational Insights out of Your Logs
Amazon Web Services
 
Scala vs Ruby
Scala vs RubyScala vs Ruby
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
Vysakh Sreenivasan
 
Final project report format
Final project report formatFinal project report format
Final project report format
Masud Sarkar
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
adamcookeuk
 
RSpec 2 Best practices
RSpec 2 Best practicesRSpec 2 Best practices
RSpec 2 Best practices
Andrea Reginato
 
Logs management
Logs managementLogs management
Logs management
Mantas Klasavicius
 

Viewers also liked (14)

Debugging rails
Debugging railsDebugging rails
Debugging rails
 
MongoDB Operational Best Practices (mongosf2012)
MongoDB Operational Best Practices (mongosf2012)MongoDB Operational Best Practices (mongosf2012)
MongoDB Operational Best Practices (mongosf2012)
 
Petty Cash Management - How To Manage Logs and Transactions
Petty Cash Management - How To Manage Logs and TransactionsPetty Cash Management - How To Manage Logs and Transactions
Petty Cash Management - How To Manage Logs and Transactions
 
"Grand Challenges" of Log Management
"Grand Challenges" of Log Management"Grand Challenges" of Log Management
"Grand Challenges" of Log Management
 
Elastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & KibanaElastic - ELK, Logstash & Kibana
Elastic - ELK, Logstash & Kibana
 
Log Files
Log FilesLog Files
Log Files
 
Gaining Operational Insights out of Your Logs
Gaining Operational Insights out of Your LogsGaining Operational Insights out of Your Logs
Gaining Operational Insights out of Your Logs
 
Scala vs Ruby
Scala vs RubyScala vs Ruby
Scala vs Ruby
 
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
 
Final project report format
Final project report formatFinal project report format
Final project report format
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
RSpec 2 Best practices
RSpec 2 Best practicesRSpec 2 Best practices
RSpec 2 Best practices
 
Logs management
Logs managementLogs management
Logs management
 
Project Report Format
Project Report FormatProject Report Format
Project Report Format
 

Similar to Managing the logs of your (Rails) applications - RailsWayCon 2011

Managing the logs of your (Rails) applications - Arrrrcamp 2011
Managing the logs of your (Rails) applications - Arrrrcamp 2011Managing the logs of your (Rails) applications - Arrrrcamp 2011
Managing the logs of your (Rails) applications - Arrrrcamp 2011
lennartkoopmann
 
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic SystemTimely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
Accumulo Summit
 
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInDataMonitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
GetInData
 
Serverless London 2019 FaaS composition using Kafka and CloudEvents
Serverless London 2019   FaaS composition using Kafka and CloudEventsServerless London 2019   FaaS composition using Kafka and CloudEvents
Serverless London 2019 FaaS composition using Kafka and CloudEvents
Neil Avery
 
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
GetInData
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Sean Zhong
 
Logging & Metrics with Docker
Logging & Metrics with DockerLogging & Metrics with Docker
Logging & Metrics with Docker
Stefan Zier
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache Kafka
Joe Stein
 
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
Prometheus - Intro, CNCF, TSDB,PromQL,GrafanaPrometheus - Intro, CNCF, TSDB,PromQL,Grafana
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
Sridhar Kumar N
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting real
Charles Vazac
 
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
NETWAYS
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsMarcelo Pinheiro
 
How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.
Renzo Tomà
 
PRMA - Introduction
PRMA - IntroductionPRMA - Introduction
PRMA - Introduction
Bowen Cai
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdb
Roman Podoliaka
 
Fluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting realFluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting real
Akamai Developers & Admins
 
When Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting RealWhen Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting Real
Nicholas Jansma
 
Multicore
MulticoreMulticore
OpenShift/Kubernetes to Splunk log integration
OpenShift/Kubernetes to Splunk log integrationOpenShift/Kubernetes to Splunk log integration
OpenShift/Kubernetes to Splunk log integration
Michiel Kalkman
 
How to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt FileHow to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt File
CA Technologies
 

Similar to Managing the logs of your (Rails) applications - RailsWayCon 2011 (20)

Managing the logs of your (Rails) applications - Arrrrcamp 2011
Managing the logs of your (Rails) applications - Arrrrcamp 2011Managing the logs of your (Rails) applications - Arrrrcamp 2011
Managing the logs of your (Rails) applications - Arrrrcamp 2011
 
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic SystemTimely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
Timely Year Two: Lessons Learned Building a Scalable Metrics Analytic System
 
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInDataMonitoring in Big Data Platform - Albert Lewandowski, GetInData
Monitoring in Big Data Platform - Albert Lewandowski, GetInData
 
Serverless London 2019 FaaS composition using Kafka and CloudEvents
Serverless London 2019   FaaS composition using Kafka and CloudEventsServerless London 2019   FaaS composition using Kafka and CloudEvents
Serverless London 2019 FaaS composition using Kafka and CloudEvents
 
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
Functioning incessantly of Data Science Platform with Kubeflow - Albert Lewan...
 
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Strata Singapore: GearpumpReal time DAG-Processing with Akka at ScaleStrata Singapore: GearpumpReal time DAG-Processing with Akka at Scale
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
 
Logging & Metrics with Docker
Logging & Metrics with DockerLogging & Metrics with Docker
Logging & Metrics with Docker
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache Kafka
 
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
Prometheus - Intro, CNCF, TSDB,PromQL,GrafanaPrometheus - Intro, CNCF, TSDB,PromQL,Grafana
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting real
 
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 
How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.
 
PRMA - Introduction
PRMA - IntroductionPRMA - Introduction
PRMA - Introduction
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdb
 
Fluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting realFluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting real
 
When Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting RealWhen Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting Real
 
Multicore
MulticoreMulticore
Multicore
 
OpenShift/Kubernetes to Splunk log integration
OpenShift/Kubernetes to Splunk log integrationOpenShift/Kubernetes to Splunk log integration
OpenShift/Kubernetes to Splunk log integration
 
How to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt FileHow to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt File
 

Recently uploaded

By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

Managing the logs of your (Rails) applications - RailsWayCon 2011

  • 1. Managing the logs of your (Rails) applications Lennart Koopmann, RailsWayCon 2011 www.lennartkoopmann.net / @_lennart
  • 2. About me 23 years old Living in Hamburg Rails developer at XING AG Developer of Graylog2
  • 3. What is this log management stuff? Even grepping over flat files can be log management.
  • 4. Log Management Maturity Scale Log management has different levels – Raffael Marty set up a scale for that.
  • 5. Level 0 Do not collect logs at all.
  • 6. Level 1 Collect logs. Mostly simple log files from email or HTTP servers.
  • 7. Level 2 Use the logs for forensics and troubleshooting. Why was that email not sent out? Why was that HTTP 500 thrown?
  • 8. Level 3 Save searches. The most basic case would be to save a grep command you used.
  • 9. Level 4 Share searches. Store that search command somewhere so co-workers can find and use it to solve the same problem.
  • 11. Level 6 Alerting. Automate some of your troubleshooting tasks. Be warned automatically instead of waiting for a user to complain.
  • 12. Level 7 Collect more logs! We may need more sources for some use cases – Like multi-line application logs, firewall logs or even physical access logs.
  • 13. Level 8 Correlation. Manual analysis of all this new data may take too long – Correlate different sources.
  • 14. Level 9 Visual analysis.
  • 15. Next levels Pattern detection, interactive visualization, dynamic queries, anomaly detection, more sharing.
  • 16. Collecting logs Two different types.
  • 17. Type 1 Logs automatically generated from a service. For example apache2.log or mail.log – Usually huge amount of structured, but raw data. jira.graylog2.org:80 x.x.x.x - - [29/May/2011:01:47:38 +0200] "GET /browse/WEBINTERFACE-21?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel HTTP/1.1" 200 7639 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
  • 18. Type 2 Logs sent directly from within your application. Triggered for example by a log.error() call or an Exception catcher. - Possible to send structured via for example GELF 2011-05-29 18:55:51 +0200 [payment] Could not validate credit card: Got HTTP 404 from example.org
  • 19. How to send your logs Don't store the logs in flat files. Send them somewhere to get more value out of them.
  • 20. Syslog Syslog adapters for Rails are available and work pretty good.
  • 21. GELF Graylog extended log format – Let's you structure your logs. Also check out structured syslog. Ruby library, Rack exception notifier and Ruby logger available. ( www.graylog2.org )
  • 22. { ' message ':'[pay] ZOMG credit card invalid', ' full_message ':'Stacktrace.Some env vars', ' host ':'www19', ' file ':'/var/www/app.rb', ' line ':2638, ' level ':1, ' _something ':'foo', ' _something_else ':'bar' }
  • 23. AMQP Guaranteed and ordered delivery. Very flexible. Easily subscribe to the flow. Use routing keys to structure origin of the logs. Hell yeah, use this if you have an AMQP bus available. (or build one) Check out https://github.com/paukul/amqp_logging
  • 24. Throw the messages out of your app like a hot potato Loose coupling! Your logs should always leave the application without interfering it! Prefer UDP over TCP, decouple AMQP log transports. Catch all exceptions and get back into the app flow.
  • 25. Add more value to your logs For example pre-generate geo information for IP addresses or integrate the time_bandits gem.
  • 26. https://github.com/skaes/time_bandits Completed in 680.378ms (View: 28.488, DB: 5.111(2,0), MC: 5.382(6r,0m), GC: 120.100(1), HP: 0(2000000,546468,18682541,934967)) | 200 OK [ http://127.0.0.1/jobs/info ] Can generate a deep insight view of your application performance when used with LogJam: https://github.com/alpinegizmo/logjam
  • 27. Where to send your logs There are a lot of tools available.
  • 28. Hosted services: Loggly www.loggly.com Dynamic pricing based on your usage Free for 200MB/day with 1 week retention time UDP/TCP/HTTP API as input for syslog
  • 29.  
  • 30.  
  • 31. Hosted services: Splunk www.splunk.com Two license types: Free / Enterprise Supports any raw input
  • 32. Two more hosted services: www.papertrailapp.com www.logentries.com
  • 33. Open source tools: Logstash www.logstash.net Collect, parse and store logs for later use Input -> Filter -> Output Plays very well with Graylog2
  • 34. Logstash inputs For example: AMQP, file, redis, stdin, syslog, tcp, stomp, twitter
  • 35. Logstash filters For example: date, field, grep, grok, multiline
  • 36. Logstash outputs For example: amqp, elasticsearch, gelf, mongodb, redis, stdout, tcp, websocket
  • 37.  
  • 38. Open source tools: Graylog2 www.graylog2.org Accepts syslog (TCP/UDP) and GELF (+ AMQP) Rails web interface for filtering, analytics, alerting, reporting, … Stores in MongoDB
  • 39.  
  • 40.  
  • 41.  
  • 42.  
  • 43.  
  • 44. Log management use case: API consumer monitoring Something different from the usual alerting, monitoring and reporting.
  • 45. Pre-processor script (or Logstash) parses raw access log (possibly via AMQP), combines multi line log messages of API engine and extracts value.
  • 46. oauth_consumer_key, severity, http_status_code, processed (controller#action)
  • 47. Pre-processor sends the extracted value including the raw message to Graylog2.
  • 48. n.notify { :severity => 4, :short_message => “UsersController#show [500]”, :full_message => full_msg, :_oauth_consumer_key => “foo”, :_processed => “UsersController#show”, :_http_status_code => 500, ... ... }
  • 49. Now use Graylog2 and the MongoDB shell to answer questions like...
  • 50. What consumers are still using the deprecated find user by email call?
  • 51. What errors are caused by the iPhone application?
  • 52. Which applications keep causing errors?
  • 53. Which consumers are inactive?
  • 54. How many calls are done by the iPhone application and how many were it a month ago?
  • 55. Extract everything you might need from the message in a structured format you can easily parse and query later. You already have all the data you need!
  • 56. Q & A @_lennart www.lennartkoopmann.net