From d0e6bf831d6a1a3c55f1d64abbc2bb95f071ac09 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 23 Apr 2017 07:15:35 -0700 Subject: [PATCH] Add "%I" (instance name) to application log formats Summary: Ref T12611. Currently, the HTTP/SSH logs don't have an option to include the instance name. Add such an option. Leave it out of the default logs because most installs don't use this. Test Plan: See next changes. Reviewers: chad, amckinley Reviewed By: chad Maniphest Tasks: T12611 Differential Revision: https://secure.phabricator.com/D17776 --- .../config/option/PhabricatorAccessLogConfigOptions.php | 1 + src/infrastructure/log/PhabricatorAccessLog.php | 1 + src/infrastructure/log/PhabricatorSSHLog.php | 1 + 3 files changed, 3 insertions(+) diff --git a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php index 6183f9936f..9ae60825ea 100644 --- a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php +++ b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php @@ -35,6 +35,7 @@ final class PhabricatorAccessLogConfigOptions 'P' => pht('The logged-in user PHID, if one is logged in.'), 'i' => pht('Request input, in bytes.'), 'o' => pht('Request output, in bytes.'), + 'I' => pht('Cluster instance name, if configured.'), ); $http_map = $common_map + array( diff --git a/src/infrastructure/log/PhabricatorAccessLog.php b/src/infrastructure/log/PhabricatorAccessLog.php index d3d9979aac..2ffa0577a8 100644 --- a/src/infrastructure/log/PhabricatorAccessLog.php +++ b/src/infrastructure/log/PhabricatorAccessLog.php @@ -30,6 +30,7 @@ final class PhabricatorAccessLog extends Phobject { 'h' => php_uname('n'), 'p' => getmypid(), 'e' => time(), + 'I' => PhabricatorEnv::getEnvConfig('cluster.instance'), )); self::$log = $log; diff --git a/src/infrastructure/log/PhabricatorSSHLog.php b/src/infrastructure/log/PhabricatorSSHLog.php index 9f9f75b41b..de4c270f72 100644 --- a/src/infrastructure/log/PhabricatorSSHLog.php +++ b/src/infrastructure/log/PhabricatorSSHLog.php @@ -20,6 +20,7 @@ final class PhabricatorSSHLog extends Phobject { 'h' => php_uname('n'), 'p' => getmypid(), 'e' => time(), + 'I' => PhabricatorEnv::getEnvConfig('cluster.instance'), ); $sudo_user = PhabricatorEnv::getEnvConfig('phd.user');