From 3cf0fc104d4ea978ce0edabc73919fb86d8ba179 Mon Sep 17 00:00:00 2001 From: mtak3 Date: Mon, 3 Jun 2019 11:15:44 +0900 Subject: [PATCH 1/2] change output message format same as FileLogEngine/ConsoleLogEngine --- src/Log/Engine/CloudwatchLog.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Log/Engine/CloudwatchLog.php b/src/Log/Engine/CloudwatchLog.php index e188d8e..22ddf4c 100644 --- a/src/Log/Engine/CloudwatchLog.php +++ b/src/Log/Engine/CloudwatchLog.php @@ -68,7 +68,10 @@ public function logger($level) public function log($level, $message, array $context = []) { - $this->logger($level)->log($level, $message, $context); + $message = $this->_format($message, $context); + $output = date('Y-m-d H:i:s') . ' ' . ucfirst($level) . ': ' . $message . "\n"; + + $this->logger($level)->log($level, $output, $context); return true; } } From 34612c890e65be9cfd169c3c8b71ab060426d7c5 Mon Sep 17 00:00:00 2001 From: mtak3 Date: Mon, 3 Jun 2019 11:20:21 +0900 Subject: [PATCH 2/2] remove default aws credentials values This default configuration interference EC2 instance role. --- src/Log/Engine/CloudwatchLog.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Log/Engine/CloudwatchLog.php b/src/Log/Engine/CloudwatchLog.php index 22ddf4c..87c2231 100644 --- a/src/Log/Engine/CloudwatchLog.php +++ b/src/Log/Engine/CloudwatchLog.php @@ -21,13 +21,15 @@ class CloudwatchLog extends BaseLog // aws 'aws' => [ - 'region' => 'eu-central-1', +/** + 'region' => env('AWS_DEFAULT_REGION', 'eu-central-1'), 'version' => 'latest', 'credentials' => [ 'key' => 'your AWS key', 'secret' => 'your AWS secret', //'token' => 'your AWS session token', ] +*/ ] ];