Skip to content

Retrieve Runtime Logs with VIP-CLI

Runtime Logs provides an aggregated, near real-time view into recent application logs generated by WordPress and Node.js environments on VIP Cloud. These logs provide insights into the current health of an environment and can be helpful for debugging issues.

Runtime Logs can also be retrieved in the Health panel of the VIP Dashboard.

Review more details about Runtime Logs and existing limitations.

Prerequisites

VIP-CLI command: vip logs [options]

Format of the vip logs command with available options:

vip logs @<app>.<env> [--type=app|batch] [--limit=<lines>] [--format=text|json|csv]

By default:

  • Logs are output to the terminal, but the command output can also be saved to a file using tee or >.
  • 500 lines of the logs will be retrieved. This can be increased by passing the vip logs command with the --limit option assigned to a higher integer, with a maximum limit of 5,000.

Example output of the Runtime Logs VIP-CLI command for a WordPress environment:

$ vip @mytestsite.production logs
2022-01-05T21:37:11.159495287Z PHP message: Warning: Division by zero in /var/www/wp-content/client-mu-plugins/errors.php on line 4 [mytestsite.go-vip.net/?warning=1] [wp-content/mu-plugins/z-client-mu-plugins.php:119 include_once('wp-content/client-mu-plugins/errors.php'), wp-settings.php:340 include_once('wp-content/mu-plugins/z-client-mu-plugins.php'), wp-config.php:53 require_once('wp-settings.php'), wp-load.php:50 require_once('wp-config.php'), wp-blog-header.php:13 require_once('wp-load.php'), index.php:17 require('wp-blog-header.php')]
2022-01-05T21:37:15.683692218Z PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function invalid_function() in /var/www/wp-content/client-mu-plugins/errors.php:8
2022-01-05T21:37:15.683720541Z Stack trace:
2022-01-05T21:37:15.683723928Z #0 /var/www/wp-content/mu-plugins/z-client-mu-plugins.php(119): include_once()
2022-01-05T21:37:15.683727274Z #1 /var/www/wp-settings.php(340): include_once('/var/www/wp-con...')
2022-01-05T21:37:15.683730831Z #2 /var/www/wp-config.php(53): require_once('/var/www/wp-set...')
2022-01-05T21:37:15.683733847Z #3 /var/www/wp-load.php(50): require_once('/var/www/wp-con...')
2022-01-05T21:37:15.683736782Z #4 /var/www/wp-blog-header.php(13): require_once('/var/www/wp-loa...')
2022-01-05T21:37:15.683739788Z #5 /var/www/index.php(17): require('/var/www/wp-blo...')
2022-01-05T21:37:15.683743695Z #6 {main}
2022-01-05T21:37:15.683746701Z   thrown in /var/www/wp-content/client-mu-plugins/errors.php on line 8

Automatically retrieve new logs

To automatically retrieve new logs without needing to re-run the vip logs command, pass the --follow option. This will enable new logs to be retrieved as they are generated. This option is useful for tools that ingest logs for long term storage and analysis (e.g. Splunk or ELK). Because logs do not persist on containers, there is no guarantee that all log entries will be received. Review the Limitations of Runtime Logs for more details.

Troubleshooting

No logs found

If a new deployment was made recently, wait a few seconds for logs to regenerate on the containers.

Error: Resource not found

A value used in the vip logs command to target an application or the environment may be incorrect, or the user running the command does not have the required minimum of Org member role or App write role to retrieve logs for that application. 

Error: Too many requests, please try again in [] seconds.

Log requests are rate limited per-user and per-application. Wait the recommended amount of time provided in the error message before attempting a new request.

Last updated: December 23, 2023

Relevant to

  • Node.js
  • WordPress