Skip to content

theodorosploumis/logging-presentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server logging for web apps

Area chart


Under Attribution 4.0 International license. Icons by icons8.

What is this talk about

  • What is logging
  • Why we need logging
  • Common logging formats
  • Logging examples
  • Logging tools

What is logging

Domain click


Why we need logging

  • Protect our app
  • Know what is going on
  • Know our visitors
  • Plan our resources & needs
  • Data is Data

Protection


How it works

Server logging diagram


Log format variables

<1. IP/domain> <2. user> <3. datetime> <4. request> <5. http-status> \
<6. request-size> <7. referrer> <8. user-agent> <9. request-time>

IP: 62.109.16.162
user: -
datetime: [26/Feb/2019:00:11:13 +0200]
request: "GET /index.php HTTP/1.1"
http-status: 200
request-size: 20702
referrer: "/user/login"
user-agent: "Mozilla/5.0 ... Chrome/43.2357.125 Safari/537.36"
request-time: 0.4

Log formats


Common log formats

// Common Log Format (CLF)
"%h %l %u %t \"%r\" %>s %b"

// Common Log Format with Virtual Host
"%v %h %l %u %t \"%r\" %>s %b"

// Extended/combined log format
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

// Referer log format
"%{Referer}i -> %U"

// Agent (Browser) log format
"%{User-agent}i"

See apache log formats.


Logging examples


Open source logging tools

Case


Tips

  • include a timestamp
  • format in JSON
  • don't log insignificant events
  • log all application errors
  • write messages in a human-readable form
  • don't log informational data in production
  • don't log anything a human can't read or react to
  • if you save logs use a nosql database

Demo


Thank you!

Join Serres Hackathon 2019 11 & 12 May 2019

Questions?

Releases

No releases published

Packages

No packages published