Details
-
Improvement
-
Status: Done
-
Medium
-
Resolution: Done
-
2.4.0
-
3
-
Yes
-
Yes
-
[obsolete] Implex
Description
User story:
- 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.
UI(CLI):
#pmm-admin summary
Will include pmm-agent.log file inside
Acceptance criteria:
- 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'
Original report:
The pmm-admin summary outputs for the client don't contain output logs for pmm-agent itself:
shell> ls -1 list.txt pmm-admin-version.txt pmm-agent-config.yaml pmm-agent-version.txt status.json
An output like the following should be included:
journalctl -u pmm-agent
Tested with:
shell> pmm-admin --version ProjectName: pmm-admin Version: 2.4.0 PMMVersion: 2.4.0 Timestamp: 2020-03-18 12:47:10 (UTC) FullCommit: bebe0b245b660eb6328f5a8ddb5b8805ca234dac
Suggested implementation:
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
**