A Terminus plugin that:
- download site logs from a specific environment of a Pantheon sites
- parse the logs for debugging purposes
This will also pull logs on an environment with multiple containers.
Learn more about Terminus and Terminus Plugins at: https://pantheon.io/docs/terminus/plugins/
Download all logs from dev
.
terminus logs:get <site>.<env>
Only download nginx-access.log and nginx-error.log logs.
terminus logs:get <site>.<env> --nginx-access --nginx-error
Exclude nginx-access.log and nginx-error.log from download.
terminus logs:get <site>.<env> --exclude --nginx-access --nginx-error
terminus logs:parse:nginx-access <site>.<env> --filter="301" --php
terminus logs:parse:nginx-access <site>.<env> --grouped-by=ip
terminus logs:parse:nginx-access <site>.<env> --grouped-by=response-code
terminus logs:parse:nginx-access <site>.<env> --grouped-by=403
terminus logs:parse:nginx-access <site>.<env> --grouped-by=404
terminus logs:parse:nginx-access <site>.<env> --grouped-by=php-404
terminus logs:parse:nginx-access <site>.<env> --grouped-by=php-404-detailed
terminus logs:parse:nginx-access <site>.<env> --grouped-by=502
To get 502 URIs run this command first: terminus logs:parse:nginx-access site_name.env --grouped-by=502
terminus logs:parse:nginx-access <site>.<env> --grouped-by=ip-accessing-502 --uri={SITE_URI}
terminus logs:parse:nginx-access <site>.<env> --grouped-by=request-per-second
terminus logs:parse:nginx-access <site>.<env> --grouped-by=request-method --code=[200|403|404|502]
terminus logs:parse:nginx-error <site>.<env> --grouped-by="access forbidden"
terminus logs:parse:nginx-error <site>.<env> --grouped-by="SSL_shutdown"
This error means that the site has no enough PHP workers. Consider upgrading to a higher plan to add more appservers.
terminus logs:parse:nginx-error <site>.<env> --grouped-by="worker_connections"
You can adjust the results by passing a numeric value to --filter
which has a default value of 10
.
terminus logs:parse:nginx-error <site>.<env>
terminus logs:parse:php-error <site>.<env> --grouped-by=latest
terminus logs:parse <site>.<env> --type=php-error --filter="Uncaught PHP Exception" --php
terminus logs:parse <site>.<env> --type=all --filter="error" --php
terminus logs:parse:php-slow <site>.<env> --grouped-by=latest
terminus logs:parse:php-slow <site>.<env> --grouped-by=function
terminus logs:parse:php-slow <site>.<env> --grouped-by=minute
terminus logs:parse:mysql-slow <site>.<env>
terminus logs:parse:mysql-slow <site>.<env> --grouped-by=time
Display only the first N queries in the output. Sort output by count i.e. number of times query found in mysqld-slow-query.log.
This queries might be a good option for caching the result.
terminus logs:parse:mysql-slow <site>.<env> --grouped-by=query-count
Top queries which returned maximum rows.
terminus logs:parse:mysql-slow <site>.<env> --grouped-by=average-rows-sent
terminus logs:list <site>.<env>
This plugin is not working on Windows environment. You may want to Dockerized your Terminus to use this kind of plugin that uses nix commands to parse the logs.
For help installing, see Manage Plugins
mkdir -p ~/.terminus/plugins
cd ~/.terminus/plugins
git clone https://github.com/pantheon-systems/terminus-site-debug.git
To install this in Terminus 3, run this command:
terminus self:plugin:install pantheon-systems/terminus-site-debug
- To https://github.com/jfussion for the idea and initial codebase.