Here are some best practices for monitoring API traffic and logs:
• Send key metrics to a monitoring system - Send critical metrics like request count, error rate, response time, and throughput to a monitoring solution. This could be:
- Apigee's own analytics
- An external tool like Datadog, New Relic, Splunk, etc.
• Set up alerts - Within your monitoring system, set up alerts for important metrics like:
- Spikes in error rate
- Sustained high latency
- Significant traffic drops
- Abnormally high CPU usage on API hosts
• Monitor logs centrally - Send API logs to a centralized log aggregator that allows searching, filtering and correlation of logs. This could be:
- Apigee logs
- ELK Stack
- Splunk, Sumo Logic, Datadog, etc.
• Define important log patterns - Determine what common issues, errors and attacks to look for in API logs. Define patterns to search and alert on.
• Audit logs - Regularly search logs for signs of unauthorized access, data leaks or other security incidents.
• Check API health - Monitor API uptime and error rates to determine overall API health and stability.
• Set SLAs - Define Service Level Agreements for key metrics like availability, latency and error budgets to help determine "normal" API performance.
• Compare to historical data - Compare current metrics and logs to historical norms to detect any abnormal trends that indicate issues.
In summary, the keys are centralizing your logging, shipping the right metrics to a monitoring system, defining important log patterns and alerts, and benchmarking API performance to determine when issues arise. With these practices, you'll have visibility into the health, stability and security of your APIs.
Hope this gives you some good monitoring best practices to implement! Let me know if you have any other questions.
No comments:
Post a Comment