1. “ A large fraction of the flaws in software
development are due to programmers not
fully understanding all the possible states
their code may execute in.”
- John Carmack.
13년 2월 21일 목요일
2. “ A large fraction of the flaws in software
development are due to programmers not
fully understanding all the possible states
their code may execute in.”
- John Carmack.
☛ We can fix bugs by understanding
states where our code was executing in.
13년 2월 21일 목요일
6. What is log?
• Record of continuos events
• ex) Black Box of an Airplane
• For complex, little-interaction system
• Long term iteration
13년 2월 21일 목요일
7. Why is log important?
• For obscure, unreproducible problems
• Pinpoint, analyze & fix
• Understand complex activities at large
• (Very) Often, log is your last resort!
13년 2월 21일 목요일
9. Format
• Text, one line, consistent field delimiter
• Timestamp
• timezone, milli-seconds, NTP
• Unique identifier
• transaction id, session id
• Log level - infos as well as problems
• debug, info, warning, error, critical
13년 2월 21일 목요일
10. Output
• Console, file, network, etc..
• Multiple output targets
• File is a fairly reliable output
• Better to have async log writer
• Buffer & thread, throttling policy
13년 2월 21일 목요일
11. Rotating & archiving
• Solution for growing log files
• Disk full is common cause of false
operation
• Remove old files with rules
• by size, time, backup count,
• Archiving if needed
13년 2월 21일 목요일
12. Configurable
• Change log level, format, output, etc..
• Config file - no recompile
• Dynamic reloading is handy
13년 2월 21일 목요일
13. Log Centralization
• Collect logs from various sources
• application, database, network, system,
performance (iostat, vmstat, ps, ... )
• Log client / server
13년 2월 21일 목요일
14. A Complex System
Chat Server Log
DB
Channel Server Game Server
Client
Game
Login Server DB Billing Server
Billing
DB
Patcher CDN
Browser Web Server
Web
Switch
DB
Web Server
13년 2월 21일 목요일
15. Complex Logs
Chat Log
Channel Log
Game Log
Login Log
Client Log
Billing Log
Patcher Log
Web Log
Switch Log
Web Log
13년 2월 21일 목요일
16. Centralized Logs
Web Log
Patcher Log
Channel Log
Login Log
Game Log
Client Log Timeline
Chat Log
Switch Log
Billing Log
Client Log
Web Log
13년 2월 21일 목요일
18. When?
• Developing stage
• Understand application states and flows
• Monitoring stage
• Is everything going well?
• Debugging stage
• What had happened when something
went wrong?
13년 2월 21일 목요일
19. How?
• Classic Tools
• grep
• awk
• sed
• Custom Tools
13년 2월 21일 목요일