- As a PMM user, I need to have logs of pmm-agent and all exporters and other components managed by pmm-agent in Zip file we generate by pmm-admin summary command so that file has much more information and simplifies support cases investigations.
Will include pmm-agent.log file inside
- recent logs of all exporters included in "summary zip" together with pmm-agent, vmagent, and other possible components managed by pmm-agent
- logs from all binaries managed by pmm-agent included into one file in zip archive returned by 'pmm-admin summary'
The pmm-admin summary outputs for the client don't contain output logs for pmm-agent itself:
An output like the following should be included:
Ring buffer implementation example in go: https://github.com/smallnest/ringbuffer
Logrus hook: https://github.com/sirupsen/logrus
- Add endpoint "/logs.zip" in pmm-agent to get logs.
- Response should be a zip file
- pmm-agent endpoint should also add logs from all running binaries.
- Keep them in one file.
- Store all logrus logs related to pmm-agent in ring buffer.
- Add request to get logs from pmm-agent endpoint in summary command in pmm-admin.
- Move all log files from logs.zip into logs directory in pmm-admin-summary.zip.
- Use the same approach like we use here https://github.com/percona/pmm-managed/blob/0e1553888d785269ea7eca0c3daa7a6f78eef9a2/services/supervisord/logs.go#L314
How to test:
- Run pmm-agent
- Add mysql and mongodb service
- Run pmm-admin summary command
- Check that ~/pmm-agent/ folder in logs ZIP file contains logs of pmm-agent
- Check that ~/pmm-agent/ folder in logs ZIP file contains following logs:
- mysqld_exporter logs
- mongodb_exporter logs
- qan agent logs
- pmm-agent log