Logging Flashcards
Can you discuss the key components of a well-structured log message?
- timestamp
- log level
- source identifier
- log message
How do you ensure that log messages are both informative and actionable for identifying issues quickly?
- Be concise
- Follow a standard
- Correlate across services using a transaction ID
How would you approach designing a centralized logging system that aggregates logs from different services?
- Use the appropriate tool (ELK or cloud-native)
- Configure microservices to configured to ship logs to a central repository
- Use log aggregation and indexing to search and correlate logs
- Look at sharding and scaling techniques
- manage indexing settings and optimize queries
- consider log sampling for high-traffic services
How do you ensure proper handling of sensitive data in logs to comply with security and privacy regulations?
- avoid logging sensitive information
- use log masking
- use token redaction
- regularly audit log configurations
- create automated checks to maintain compliance with privacy regulations
- implement access controls to limit log access
Can you describe techniques like log masking and token redaction that are used to strike a balance between logging visibility and data protection?
- log masking: sensitive values are replaced with placeholders or hashed representations
- token redaction: omitting sensitive data from logs while maintaining a reference to the token for debugging purposes
How would you manage log retention and storage effectively?
- balancing act between analysis needs and storage costs
- configure log rotation settings based on time or size thresholds
- automatically compress and archive older logs
- implement tiered storage approach (recent logs are stored in high-performance storage and older logs in cost-effective storage tiers)
- review retention policies and collaborate with stakeholders
What’s the difference between events and structured logs?
- events describe a unit of work
- events contain all of the information about what it took for a service to perform a certain job
- logs are only portions of events
- a group of logs can compose a single event
- an event is a conceptual abstraction and a structured log is one possible representation of that abstraction
What is a log?
- a collection of messages
- written to disk
- sometimes streamed
- line-delimited
- messages may or may not be related to each other
What is a structured log?
- all the characteristics of Log
- represented using a structured format (key/value pairs)
What is an event?
An event contains information about what it took for a service to perform a unit of work