24
Just log PuGong Induction training of Dev Team

Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

JustlogPuGong

Induction trainingofDevTeam

Page 2: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Agenda

• What’sLog

• Whatshouldbelogged

• Howtousethelog• Examplesof Log System

• Q&A

Page 3: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

What’sLog

• arecordofajourneymadebyashiporaircraft,detailingallevents,or

thebookinwhichitiskept

• (Computers)Anyofvariouschronologicalrecordsmadeconcerning

theuseofacomputersystem,thechangesmadetodata,etc.

• The logsareoftenmet

• Transaction Log�Binlog

• Operation Log• Application Log

Page 4: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Aretheylog

•&���� ������*�� ,�

• Black-box

Page 5: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Keypointoflog

• Timestamp

• Sequence• Meaningful

• Formatofrecords

• Contents• Immutable

• StructuredvsUnstructured

Page 6: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

WhyLogareimportant

• Complianceandregulations:Provideanaudittrailofwho,what,

where,whenandwhy

• Situationalawareness• Incidentreponse• Realtimealerts

Page 7: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Operationlog

• Purpose• Keepthetrackofwhatuserhaddone• ForAUDIT• ForTrackofrecordchange

• Keyelements

• When - Timestamp

• Who- User

• What- whatwasdid

• Where- IP/Host

• Identifier- Table(moudle)Name,record_id

Page 8: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

SampleofOperationLog

Page 9: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Applicationlog

• Purpose• Keepnecessaryapplicationrunninginformation

• Foronlineproblemanalysis

• Fordebug• Keyelements

• When- Timestamp

• What

• LogLevel

• (Error)Message

• Stacktrace

• Where– Host/IP

• Secure– removesensitiveinformation

• Centralize

Page 10: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

LogLevel

• Debug:Usedonlyfordevelopmentandtesting.Temporaryopenon

productiontofindmoreinformation.(Cautionwiththelogsize)

• Information:Usedtokeeptheinformationthatisusefulforsystem

runningandmanagement. Theentryandexitpointsofkeyfunctions

shouldbekeptinthislevel.

• Warning:Usedtokeepthehandledexceptionsorotherimportantlogevents.

• Error:Usedtokeeptheunhandledexceptions• Fatal:Reservedforspecialexceptions/conditionsthatneedtobetakencareof.

Page 11: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

SampleofApplicationLog

Page 12: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Howtolog- Metriclog

• Purpose• KeepApplicationrunningstat,mainlynumbersaboutbusiness

• Monitor

• Alert• Keyelement

• When– Timestamp

• Who– AppIdentifier

• Where– Host/IP/Tags

• What- Metrics

Page 13: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

SampleofMetricLog

Page 14: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Howtolog- TraceLog

• Purpose• AnuniqueIdtolinkthelogsindifferentapplication

• Generatedattheverybeginningattherequest

• Saveineverylogsasafieldoratag

• Onlineproblemanalysis

• Userbehaviortracking• KeyElements

• What– uniquetracke Idinotherlog

• Others– almostthesameas

Page 15: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Howtousethelogs

• Metricsformonitorandalert

• Wherealertsrings,gotoapplicationlogfordetailinformation

• Usetracetofindassociationlogsinotherappisnecessary

• Prediction

Page 16: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Howtouselogs

Collect

Alert

Store

Search,

Report,

Analytics

Make

conclusions

Act

Humansneeded!

Files,syslog,etc

SMS,E-mail,etc

Immutablelogs

Page 17: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

LogSystem

• ELK– Metrics,applicationlogetc

• Statsd+Grafana /statsd +graphite– Metrics

• Splunk – commercial

• Customized

Page 18: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

ELK

Watcher Shield

Page 19: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Splunk

Page 20: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

StatSD +Grafana

Page 21: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

ACustimized Logsystemarchitecture

Page 22: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Logagent

Page 23: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

SumUp

• Carefulchooseloglevel• Centralizethelogs• Securethelogs

• DoLog• DoUsethelog:

• Monitor&Alert

• Analysisthelogs

Page 24: Induction training - Log - pugong.mepugong.me/images/att/induction-training-just-log.pdfKey point of log • Timestamp • Sequence • Meaningful • Format of records • Contents

Reference

• TheLog:Whateverysoftwareengineershouldknowaboutreal-timedata's

unifyingabstraction

• ���!�(��$�+�'#)"������"%���• LogEverythingAllTheTime

• http://play.grafana.org/• ElasticSearch,Logstash&Kibana• Splunk:http://www.splunk.com/

• Zabbix:https://www.zabbix.com/

• Cacti:http://cacti.net/• nagios:https://www.nagios.org/