diff --git a/.env.example b/.env.example index 8f63f0dcac..fef062e6d8 100644 --- a/.env.example +++ b/.env.example @@ -104,3 +104,6 @@ BUGSNAG_FILTERS=password,authid,authpassword,apikey_pub,access_token,x-newrelic- BUGSNAG_BATCH_SENDING=true BUGSNAG_NOTIFY_RELEASE_STAGES=production,staging BUGSNAG_QUERY_BINDINGS=true + +BETTERSTACK_SOURCE_TOKEN= +BETTERSTACK_LOG_LEVEL=debug diff --git a/app/Jobs/UpdateMember.php b/app/Jobs/UpdateMember.php index 8bd2320ccb..4fd163cc43 100644 --- a/app/Jobs/UpdateMember.php +++ b/app/Jobs/UpdateMember.php @@ -58,7 +58,7 @@ public function handle() try { $member = Account::findOrFail(['id' => $this->accountID])->first(); } catch (ModelNotFoundException $e) { - Log::info("Member {$this->accountID} not found in database. Auth needed to fetch data."); + Log::debug("Member {$this->accountID} not found in database. Auth needed to fetch data."); return; } diff --git a/composer.json b/composer.json index 66f770153b..2ad5990bc9 100644 --- a/composer.json +++ b/composer.json @@ -80,6 +80,7 @@ "league/csv": "^9.0", "league/oauth2-client": "^2.4", "livewire/livewire": "^3.5", + "logtail/monolog-logtail": "^3.2", "maatwebsite/excel": "~3.1.17", "malahierba-lab/public-id": "dev-main", "ohdearapp/ohdear-php-sdk": "^3.0", @@ -170,4 +171,4 @@ "php-http/discovery": true } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index e184a59af2..cbee2967e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d766b8dff3b0a64661d62e440294c797", + "content-hash": "d316bc8482fd5787d36248861436ef18", "packages": [ { "name": "alawrence/laravel-ipboard", @@ -5273,6 +5273,54 @@ ], "time": "2024-10-15T19:35:06+00:00" }, + { + "name": "logtail/monolog-logtail", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/logtail/monolog-logtail.git", + "reference": "6436570d9731172d76147247e04e57cccfcca1d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/logtail/monolog-logtail/zipball/6436570d9731172d76147247e04e57cccfcca1d3", + "reference": "6436570d9731172d76147247e04e57cccfcca1d3", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "monolog/monolog": "^3", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Logtail\\Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "description": "Logtail handler for Monolog", + "homepage": "https://github.com/logtail/logtail-php", + "keywords": [ + "handler", + "log", + "logger", + "logging", + "monolog", + "php" + ], + "support": { + "issues": "https://github.com/logtail/monolog-logtail/issues", + "source": "https://github.com/logtail/monolog-logtail/tree/v3.2.0" + }, + "time": "2024-06-27T13:24:36+00:00" + }, { "name": "lorisleiva/cron-translator", "version": "v0.4.5", diff --git a/config/logging.php b/config/logging.php index f3e6a8b7ee..87361a6210 100644 --- a/config/logging.php +++ b/config/logging.php @@ -37,7 +37,7 @@ 'channels' => [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['daily', 'bugsnag'], + 'channels' => ['daily', 'bugsnag', 'betterstack'], ], 'training' => [ @@ -57,7 +57,7 @@ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, + 'days' => 10, ], 'slack' => [ @@ -114,6 +114,15 @@ 'bugsnag' => [ 'driver' => 'bugsnag', ], + + 'betterstack' => [ + 'driver' => 'monolog', + 'level' => env('BETTERSTACK_LOG_LEVEL', 'debug'), + 'handler' => Logtail\Monolog\LogtailHandler::class, + 'with' => [ + 'sourceToken' => env('BETTERSTACK_SOURCE_TOKEN'), + ], + ], ], ]; diff --git a/routes/web-external.php b/routes/web-external.php index bd6ab2b471..dcab84be90 100644 --- a/routes/web-external.php +++ b/routes/web-external.php @@ -11,6 +11,12 @@ ], function () { Route::post('webhook', function () { + Log::info(print_r([ + 'Authorization' => request()->header('Authorization'), + 'User-Agent' => request()->header('User-Agent'), + 'Body' => request()->all(), + ], true)); + return response()->json([ 'status' => 'ok', ]);