Archive logs on log aggregation server
The article describes the steps required to create an archive with selected logs (which might be requested in a support ticket for investigation).
note
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 the user to the default wfuser, and change the directory to INSTALL_DIR/logs.
su - wfuser
cd /opt/workfusion/logs/
Get supported options
Run /opt/workfusion/tools/log_archive.sh to get the 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 creating a log 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 previous or next date.
- It is better to archive for an additional date before and after the incident to be sure that all logs are gathered.
For more details on available options, see Reference for log_archive script.
Archive specific logs
Run the /opt/workfusion/tools/log_archive.sh script to archive specific logs
The following command collects logs for the Nginx component on the DB and APP groups on 2018-11-01 and packs them into the 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