Archive logs on log aggregation server
The article describes necessary steps to create archive with selected logs (which might be requested in a support ticket for investigation).
Be sure to run these steps as the runtime user (as defined in the wf_user variable in config.yml).
- Log in via SSH to PM server.
- Change a user to the default user
wfuser. Change a directory toINSTALL_DIR/logs.
su - wfuser
cd /opt/workfusion/logs/
- Run
/opt/workfusion/tools/log_archive.shto get description of what options are supported.
$ /opt/workfusion/tools/log_archive.sh
Usage: log_archive.sh [-c <component filter> -d <date filter> -g <group name> -h <server hostname>]
Options -c, -d, -g, -h can be used multiple time
Examples:
log_archive.sh -c nginx -g db -g app # collect logs for nginx component from db and app groups
log_archive.sh -c workfusion -c nginx -g app # collect logs for nginx, workfusion components from app group
log_archive.sh -c nginx -g app -g db -g apm -d 2018-10-* # collect logs for nginx from db, app and apm groups on October 2018
While making logs archive it is important to keep in mind the following things. Date pattern is UTC-based. It might happen that some required logs might be in the previous or next date. It is better to archive for additional date before and after incident to be sure that all logs are gathered.
For more details on available options - see Reference for log_archive script.
- Run the
/opt/workfusion/tools/log_archive.shscript to archive specific logs.
The next command will collect logs for nginx component on DB and APP groups on date 2018-11-01 and pack them into current directory in the wf-logs-.tar.gz file.
$ /opt/workfusion/tools/log_archive.sh -c nginx -g db -g app -d 2018-11-01 # collect logs for nginx component from db and app groups
tar: Removing leading `/' from member names
/opt/workfusion/logs/db/db-example.workfusion.com/nginx/2018-11-01/nginx.err.log
/opt/workfusion/logs/db/db-example.workfusion.com/nginx/2018-11-01/nginx.out.log
/opt/workfusion/logs/app/app-example.workfusion.com/nginx/2018-11-01/nginx.out.log
/opt/workfusion/logs/app/app-example.workfusion.com/nginx/2018-11-01/nginx.err.log
^^ Logs were packed into archive wf-logs-1541062518.tar.gz in current directory
- Validate that the archive is not empty and contains all required files.
$ ls -la wf-logs-1541062518.tar.gz
-rw-rw-r--. 1 wfuser wfuser 71562 Nov 1 08:55 wf-logs-1541062518.tar.gz