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 the WPVIP Platform. These logs provide insights into the current health of an environment and can be helpful for debugging issues.

Runtime Logs can also beretrieved in the Health panelof theVIP Dashboard.

Reviewmore details about Runtime Logs and existing limitations.

Prerequisites

VIP-CLI command:vip logs [options]

Format of thevip logscommand with available options:

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

By default:

  • Logs are output to the terminal, but thecommand output can also be saved to a fileusingteeor>.
  • 500 lines of the logs will be retrieved. This can be increased by passing thevip logscommand with the--limitoption assigned to a higher integer, with a maximum limit of 5,000.

Example output of the Runtime LogsVIP-CLIcommand for a WordPress environment:

$ vip @example-app.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 [example-app.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 thevip logscommand, pass the--followoption. 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.Splunkor ELK). Because logs do not persist on containers, there is no guarantee that all log entries will be received. Review theLimitationsofRuntime Logsfor 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 thevip logscommand totarget an application or the environmentmay be incorrect, or the user running the command does not have the required minimum ofOrg member roleorApp write roleto 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: November 19, 2024

Relevant to

  • Node.js
  • WordPress