In Microservice Architecture (MSA), it is recommended to use centralized Logging and monitoring tools.
Logging in MSA
Components required for logging:
Log Store: where logs are going to be stored.
Logging API: An API responsible for logging the log details.
User interface to view the logs.
Types of logging information:
Information:
Only business-related information
And, should not contain technical information
Error:
Error or exception raised into the service
Call stack details
Debug
Technical information like response time of a method, input or output parameters, etc.
Note: Use a unique transaction or correlation id to identify the transaction.
Monitoring in MSA
Continuous monitoring is always required in MSA. To start, identify what to be monitored, note down all points and evaluate all available monitoring solutions and tools.
Types of monitoring information:
Application Performance Monitoring
Infrastructure and Network Monitoring
Resource Monitoring
Security Monitoring
Few common monitoring points:
Number of requests per API.
Request categorization by criteria (for example, remote-host).
Monitoring containers and APIs.
Performance statistics like CPU usage, latency, etc.