Skip to content

Instantly share code, notes, and snippets.

@joshkoenig
Last active December 30, 2015 20:49
Show Gist options
  • Select an option

  • Save joshkoenig/7883221 to your computer and use it in GitHub Desktop.

Select an option

Save joshkoenig/7883221 to your computer and use it in GitHub Desktop.
Terminus log fetching pseudocode.
<?php
# Get the list of application endpoints and binding IDs
# https://github.com/pantheon-systems/terminus/blob/master/terminus.site.api.inc#L265
$bindings = terminus_api_site_environment_bindings($site_uuid, $env, 'appserver');
foreach ($bindings as $bid => $binding) {
$host = $binding->host;
# Now grab them all with SFTP.
# This assumes you have a ssh key with no pass, or a running ssh agent.
passthru("echo 'get logs/nginx-access.log nginx-$bid.log'|sftp -o Port=2222 -b - $env.$site_uuid@$host");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment