Logging
Useful for getting more information about code to help debug an issue. For example, having logs to track a single user as they attempt to use a site.
You need something to collect the logs and store them in some sort of database for use in analysis.
In your code, you will add logging to include messaging that describes what is occurring in the code.
An agent will collect the logs and forward them to something that can store the logs for offline analysis.
Monitoring
Is a tool that makes managing a system easier. This adds visibility into a system’s health, availability, and status. This collects useful information and makes it possible to monitor this information.
- Error rates
- Latency
- Login counts
- Response times.
Make sure you have systems in play to monitor your overall system to make sure the system is healthy.
You can start by aggregating metrics from the data in the logs. This may be limiting to a degree but is a reasonable starting point.
Collect metrics in a time series database.
Grafana can be used to create graphs from a time series database.
Alerting
To make the monitoring useful, you might want to know when error rates exceed a threshold. A monitoring system can be used to trigger alerts to ensure that the interested parties are notified so that action can be taken to deal with the unhealthy state.