What are logs and monitoring?
Options
- Logs record events your app writes; monitoring tracks metrics and alerts (Correct option)
- Logs are passwords, and monitoring is the encryption of data
- Logs are tests, and monitoring is the compiler of the code
- They are the same thing, only named by different teams
Answer
Logs are a record of events your app writes; monitoring is watching metrics and alerts to know whether the system is healthy
Why
When something fails in production you can't attach a debugger, so you read the logs: timestamps, severity levels (INFO, WARN, ERROR) and messages.
Monitoring tracks numbers over time (response time, error rate, CPU) and sends alerts when they go beyond a threshold.
In containers the convention is to write logs to the standard output; for example docker logs <container> or kubectl logs <pod> shows them.
Remember
Logs = what happened. Monitoring = is it healthy now?