Get them: online presentation / source code
Under Attribution 4.0 International license. Icons by icons8.
- What is logging
- How it works
- Why we need logging
- Common logging formats
- Logging examples
- Logging tools
A server log is a log file (or several files) automatically created and maintained by a server consisting of a list of activities it performed (eg a history of page requests).
- Protect our app
- Know what is going on
- Know our visitors
- Plan our resources & needs
- Data is Data
<1.address> <2.user> <3.datetime> <4.request> <5.http-status> \
<6.request-size> <7.referrer> <8.user-agent> <9.request-time>
variable | value |
---|---|
address | 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 ... Safari/537.36" |
request-time | 0.4 |
// 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.
- format in JSON
- use the common log-formats
- if you save logs use a nosql database
- log all application errors
- write messages in a human-readable form
- don't log informational data in production
- don't log insignificant events
- don't log anything a human can't read or react to
Join Serres Hackathon 2019 May 2019