SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
“ 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일 목요일
“ 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일 목요일
Logging 101
                  haje01@gmail.com




13년 2월 21일 목요일
Agenda

                 • Log?
                 • How to log?
                 • Log analysis
                 • Case Study

13년 2월 21일 목요일
Log?



13년 2월 21일 목요일
What is log?

                 • Record of continuos events
                  • ex) Black Box of an Airplane
                 • For complex, little-interaction system
                 • Long term iteration

13년 2월 21일 목요일
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일 목요일
How to log



13년 2월 21일 목요일
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일 목요일
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일 목요일
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일 목요일
Configurable


                 • Change log level, format, output, etc..
                 • Config file - no recompile
                 • Dynamic reloading is handy

13년 2월 21일 목요일
Log Centralization

                 • Collect logs from various sources
                  • application, database, network, system,
                     performance (iostat, vmstat, ps, ... )
                 • Log client / server


13년 2월 21일 목요일
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일 목요일
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일 목요일
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일 목요일
Log analysis



13년 2월 21일 목요일
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일 목요일
How?

                 • Classic Tools
                  • grep
                  • awk
                  • sed
                 • Custom Tools

13년 2월 21일 목요일
Case Study



13년 2월 21일 목요일
syslog
                 •   1980 Eric Allman ( now standard )

                 •   Separates dependencies

                 •   Multi-purpose & devices

                     •   system management, security auditing,
                         informational & debugging messages

                     •   servers, printers, routers

                 •   Facility

                     •   auth, daemon, cron, ftp, lpr, kern, mail, user..


13년 2월 21일 목요일
13년 2월 21일 목요일
log4j / log4cxx
                 • Logging utility
                 • Logger, appenders and layouts
                 • Buffering, Rotating
                 • Configurable
                  • dynamic reloading
                 • Plugin
13년 2월 21일 목요일
fluentd

                 • The Log Collector
                   • ‘syslogd that understands JSON’
                 • Pluggable Architecture
                   • Input(Http + JSON), Buffer(Memory, File),
                     Output(File, AmazonS3, Fluentd, ... )



13년 2월 21일 목요일
loggly

                 •   Cloud-based log management
                     •   unlimited storage
                 •   Web-based log analysis
                     •   access logs anywhere
                 •   Application debugging, Deployment
                     monitoring


13년 2월 21일 목요일
13년 2월 21일 목요일
Q&A



13년 2월 21일 목요일
Refs.
                 •   python log config - http://docs.python.org/2/library/
                     logging.config.html


                 •   Log4j best practices - http://juliusdavies.ca/logging.html

                 •   Logging best practices - http://dev.splunk.com/view/logging/SP-
                     CAAADP6


                 •   Log4j/cxx - http://logging.apache.org/log4j/2.x/ http://
                     logging.apache.org/log4cxx/


                 •   Fluentd - http://fluentd.org http://before30.tistory.com/179

                 •   Loggly - http://loggly.com


13년 2월 21일 목요일

Contenu connexe

En vedette

파이콘 한국 2015 디자인 후기
파이콘 한국 2015 디자인 후기파이콘 한국 2015 디자인 후기
파이콘 한국 2015 디자인 후기Hyun-woo Park
 
Dive into OpenSource
Dive into OpenSourceDive into OpenSource
Dive into OpenSourceHyun-woo Park
 
파이썬 삼총사 : Tox, Travis 그리고 Coveralls
파이썬 삼총사 : Tox, Travis 그리고 Coveralls파이썬 삼총사 : Tox, Travis 그리고 Coveralls
파이썬 삼총사 : Tox, Travis 그리고 CoverallsHyun-woo Park
 
파이썬 TDD 101
파이썬 TDD 101파이썬 TDD 101
파이썬 TDD 101정주 김
 
WE HAVE ALMOST NOTHING, SMARTSTUDY
WE HAVE ALMOST NOTHING, SMARTSTUDYWE HAVE ALMOST NOTHING, SMARTSTUDY
WE HAVE ALMOST NOTHING, SMARTSTUDYHyun-woo Park
 
Django in Production
Django in ProductionDjango in Production
Django in ProductionHyun-woo Park
 
그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라Hyun-woo Park
 
스타트업에서 기술책임자로 살아가기
스타트업에서 기술책임자로 살아가기스타트업에서 기술책임자로 살아가기
스타트업에서 기술책임자로 살아가기Hyun-woo Park
 

En vedette (8)

파이콘 한국 2015 디자인 후기
파이콘 한국 2015 디자인 후기파이콘 한국 2015 디자인 후기
파이콘 한국 2015 디자인 후기
 
Dive into OpenSource
Dive into OpenSourceDive into OpenSource
Dive into OpenSource
 
파이썬 삼총사 : Tox, Travis 그리고 Coveralls
파이썬 삼총사 : Tox, Travis 그리고 Coveralls파이썬 삼총사 : Tox, Travis 그리고 Coveralls
파이썬 삼총사 : Tox, Travis 그리고 Coveralls
 
파이썬 TDD 101
파이썬 TDD 101파이썬 TDD 101
파이썬 TDD 101
 
WE HAVE ALMOST NOTHING, SMARTSTUDY
WE HAVE ALMOST NOTHING, SMARTSTUDYWE HAVE ALMOST NOTHING, SMARTSTUDY
WE HAVE ALMOST NOTHING, SMARTSTUDY
 
Django in Production
Django in ProductionDjango in Production
Django in Production
 
그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라
 
스타트업에서 기술책임자로 살아가기
스타트업에서 기술책임자로 살아가기스타트업에서 기술책임자로 살아가기
스타트업에서 기술책임자로 살아가기
 

Logging 101

  • 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일 목요일
  • 3. Logging 101 haje01@gmail.com 13년 2월 21일 목요일
  • 4. Agenda • Log? • How to log? • Log analysis • Case Study 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일 목요일
  • 8. How to log 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일 목요일
  • 17. Log analysis 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일 목요일
  • 20. Case Study 13년 2월 21일 목요일
  • 21. syslog • 1980 Eric Allman ( now standard ) • Separates dependencies • Multi-purpose & devices • system management, security auditing, informational & debugging messages • servers, printers, routers • Facility • auth, daemon, cron, ftp, lpr, kern, mail, user.. 13년 2월 21일 목요일
  • 22. 13년 2월 21일 목요일
  • 23. log4j / log4cxx • Logging utility • Logger, appenders and layouts • Buffering, Rotating • Configurable • dynamic reloading • Plugin 13년 2월 21일 목요일
  • 24. fluentd • The Log Collector • ‘syslogd that understands JSON’ • Pluggable Architecture • Input(Http + JSON), Buffer(Memory, File), Output(File, AmazonS3, Fluentd, ... ) 13년 2월 21일 목요일
  • 25. loggly • Cloud-based log management • unlimited storage • Web-based log analysis • access logs anywhere • Application debugging, Deployment monitoring 13년 2월 21일 목요일
  • 26. 13년 2월 21일 목요일
  • 27. Q&A 13년 2월 21일 목요일
  • 28. Refs. • python log config - http://docs.python.org/2/library/ logging.config.html • Log4j best practices - http://juliusdavies.ca/logging.html • Logging best practices - http://dev.splunk.com/view/logging/SP- CAAADP6 • Log4j/cxx - http://logging.apache.org/log4j/2.x/ http:// logging.apache.org/log4cxx/ • Fluentd - http://fluentd.org http://before30.tistory.com/179 • Loggly - http://loggly.com 13년 2월 21일 목요일