mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-04-17 19:58:27 +00:00
Fix FLEXIAPI-358 Write all the logs to syslog (and by extension journald)
This commit is contained in:
parent
6550a9082c
commit
117965cb8c
18 changed files with 50 additions and 105 deletions
|
|
@ -46,11 +46,11 @@ class PasswordController extends Controller
|
|||
$account->updatePassword($request->get('password'));
|
||||
|
||||
if ($account->passwords()->count() > 0) {
|
||||
Log::channel('events')->info('Web: Password changed', ['id' => $account->identifier]);
|
||||
Log::info('Web: Password changed', ['id' => $account->identifier]);
|
||||
return redirect()->route('account.logout');
|
||||
}
|
||||
|
||||
Log::channel('events')->info('Web: Password set for the first time', ['id' => $account->identifier]);
|
||||
Log::info('Web: Password set for the first time', ['id' => $account->identifier]);
|
||||
return redirect()->route('account.logout');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class AccountTypeController extends Controller
|
|||
$account->types()->detach($request->get('account_type_id'));
|
||||
$account->types()->attach($request->get('account_type_id'));
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account type attached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]);
|
||||
Log::info('Web Admin: Account type attached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]);
|
||||
|
||||
return redirect()->route('admin.account.show', $account)->withFragment('#types');
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ class AccountTypeController extends Controller
|
|||
|
||||
$account->types()->detach($typeId);
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account type detached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]);
|
||||
Log::info('Web Admin: Account type detached', ['id' => $account->identifier, 'type_id' => $request->get('account_type_id')]);
|
||||
|
||||
return redirect()->route('admin.account.show', $account)->withFragment('#types');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ActionController extends Controller
|
|||
$accountAction->code = $request->get('code');
|
||||
$accountAction->save();
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account action created', ['id' => $account->identifier, 'action' => $accountAction->key]);
|
||||
Log::info('Web Admin: Account action created', ['id' => $account->identifier, 'action' => $accountAction->key]);
|
||||
|
||||
return redirect()->route('admin.account.show', $accountAction->account)->withFragment('#actions');
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ class ActionController extends Controller
|
|||
$accountAction->code = $request->get('code');
|
||||
$accountAction->save();
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account action updated', ['id' => $account->identifier, 'action' => $accountAction->key]);
|
||||
Log::info('Web Admin: Account action updated', ['id' => $account->identifier, 'action' => $accountAction->key]);
|
||||
|
||||
return redirect()->route('admin.account.show', $account)->withFragment('#actions');
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ class ActionController extends Controller
|
|||
->firstOrFail();
|
||||
$accountAction->delete();
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account action deleted', ['id' => $accountAction->account->identifier, 'action_id' => $accountAction->key]);
|
||||
Log::info('Web Admin: Account action deleted', ['id' => $accountAction->account->identifier, 'action_id' => $accountAction->key]);
|
||||
|
||||
return redirect()->route('admin.account.show', $accountAction->account)->withFragment('#actions');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ContactController extends Controller
|
|||
$account->contacts()->detach($contact->id);
|
||||
$account->contacts()->attach($contact->id);
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account contact added', ['id' => $account->identifier, 'contact' => $contact->identifier]);
|
||||
Log::info('Web Admin: Account contact added', ['id' => $account->identifier, 'contact' => $contact->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.contact.index', $account);
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ class ContactController extends Controller
|
|||
|
||||
$account->contacts()->detach($contact->id);
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account contact removed', ['id' => $account->identifier, 'contact' => $contact->identifier]);
|
||||
Log::info('Web Admin: Account contact removed', ['id' => $account->identifier, 'contact' => $contact->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.contact.index', $account);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class TypeController extends Controller
|
|||
$type = AccountType::findOrFail($typeId);
|
||||
$type->delete();
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account type deleted', ['type' => $type->key]);
|
||||
Log::info('Web Admin: Account type deleted', ['type' => $type->key]);
|
||||
|
||||
return redirect()->route('admin.account.type.index');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class AccountController extends Controller
|
|||
{
|
||||
$account = (new AccountService)->store($request);
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account created', ['id' => $account->identifier]);
|
||||
Log::info('Web Admin: Account created', ['id' => $account->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.show', $account);
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ class AccountController extends Controller
|
|||
{
|
||||
$account = (new AccountService)->update($request, $accountId);
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account updated', ['id' => $account->identifier]);
|
||||
Log::info('Web Admin: Account updated', ['id' => $account->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.show', $accountId);
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ class AccountController extends Controller
|
|||
$account->provision();
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account provisioned', ['id' => $account->identifier]);
|
||||
Log::info('Web Admin: Account provisioned', ['id' => $account->identifier]);
|
||||
|
||||
return redirect()->back()->withFragment('provisioning');
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ class AccountController extends Controller
|
|||
|
||||
(new AccountService)->destroy($request, $request->get('account_id'));
|
||||
|
||||
Log::channel('events')->info('Web Admin: Account deleted', ['id' => $account->identifier]);
|
||||
Log::info('Web Admin: Account deleted', ['id' => $account->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.index');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ProvisioningEmailController extends Controller
|
|||
|
||||
Mail::to($account)->send(new Provisioning($account));
|
||||
|
||||
Log::channel('events')->info('Web Admin: Sending provisioning email', ['id' => $account->identifier]);
|
||||
Log::info('Web Admin: Sending provisioning email', ['id' => $account->identifier]);
|
||||
|
||||
return redirect()->route('admin.account.show', $account);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class AccountController extends Controller
|
|||
$account->provision();
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API: Account provisioned', ['id' => $account->identifier]);
|
||||
Log::info('API: Account provisioned', ['id' => $account->identifier]);
|
||||
|
||||
return $account->makeVisible(['provisioning_token']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class CreationTokenController extends Controller
|
|||
->first();
|
||||
|
||||
if ($last) {
|
||||
Log::channel('events')->info('API: Token throttled', ['token' => $last->token]);
|
||||
Log::info('API: Token throttled', ['token' => $last->token]);
|
||||
abort(429, 'Last token requested too recently');
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class CreationTokenController extends Controller
|
|||
|
||||
$fp = new FlexisipPusherConnector($token->pn_provider, $token->pn_param, $token->pn_prid);
|
||||
if ($fp->sendToken($token->token)) {
|
||||
Log::channel('events')->info('API: Account Creation Token sent', ['token' => $token->token]);
|
||||
Log::info('API: Account Creation Token sent', ['token' => $token->token]);
|
||||
|
||||
$token->save();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class PasswordController extends Controller
|
|||
)) {
|
||||
$account->updatePassword($request->get('password'), $algorithm);
|
||||
|
||||
Log::channel('events')->info('API: Account password updated', ['id' => $account->identifier]);
|
||||
Log::info('API: Account password updated', ['id' => $account->identifier]);
|
||||
|
||||
return response()->json();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class PushNotificationController extends Controller
|
|||
$fp = new FlexisipPusherConnector($request->get('pn_provider'), $request->get('pn_param'), $request->get('pn_prid'));
|
||||
|
||||
if ($fp->send(callId: $request->get('call_id'), type: $request->get('type'))) {
|
||||
Log::channel('events')->info('API: Push notification sent', [
|
||||
Log::info('API: Push notification sent', [
|
||||
'call_id' => $request->get('call_id'),
|
||||
'type' => $request->get('type')
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class RecoveryTokenController extends Controller
|
|||
->first();
|
||||
|
||||
if ($last) {
|
||||
Log::channel('events')->info('API: Token throttled', ['token' => $last->token]);
|
||||
Log::info('API: Token throttled', ['token' => $last->token]);
|
||||
abort(429, 'Last token requested too recently');
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ class RecoveryTokenController extends Controller
|
|||
|
||||
$fp = new FlexisipPusherConnector($token->pn_provider, $token->pn_param, $token->pn_prid);
|
||||
if ($fp->sendToken($token->token)) {
|
||||
Log::channel('events')->info('API: AccountRecoveryToken sent', ['token' => $token->token]);
|
||||
Log::info('API: AccountRecoveryToken sent', ['token' => $token->token]);
|
||||
|
||||
$token->save();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class AccountController extends Controller
|
|||
|
||||
(new AccountService())->destroy($request, $accountId);
|
||||
|
||||
Log::channel('events')->info('API Admin: Account destroyed', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account destroyed', ['id' => $account->identifier]);
|
||||
}
|
||||
|
||||
public function activate(Request $request, int $accountId)
|
||||
|
|
@ -107,7 +107,7 @@ class AccountController extends Controller
|
|||
$account->activated = true;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API Admin: Account activated', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account activated', ['id' => $account->identifier]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ class AccountController extends Controller
|
|||
$account->activated = false;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API Admin: Account deactivated', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account deactivated', ['id' => $account->identifier]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ class AccountController extends Controller
|
|||
$account->blocked = true;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API Admin: Account blocked', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account blocked', ['id' => $account->identifier]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ class AccountController extends Controller
|
|||
$account->blocked = false;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API Admin: Account unblocked', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account unblocked', ['id' => $account->identifier]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ class AccountController extends Controller
|
|||
$account->provision();
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('API Admin: Account provisioned', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account provisioned', ['id' => $account->identifier]);
|
||||
|
||||
return $account->makeVisible(['provisioning_token']);
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ class AccountController extends Controller
|
|||
{
|
||||
$account = (new AccountService())->update($request, $accountId);
|
||||
|
||||
Log::channel('events')->info('API Admin: Account updated', ['id' => $account->identifier]);
|
||||
Log::info('API Admin: Account updated', ['id' => $account->identifier]);
|
||||
|
||||
return $account->makeVisible(['provisioning_token']);
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ class AccountController extends Controller
|
|||
|
||||
Mail::to($account)->send(new Provisioning($account));
|
||||
|
||||
Log::channel('events')->info('API: Sending provisioning email', ['id' => $account->identifier]);
|
||||
Log::info('API: Sending provisioning email', ['id' => $account->identifier]);
|
||||
}
|
||||
|
||||
public function sendResetPasswordEmail(Request $request, int $accountId)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class StatisticsCallController extends Controller
|
|||
try {
|
||||
return $statisticsCall->saveOrFail();
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('database_errors')->error($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
abort(400, 'Database error');
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class StatisticsCallController extends Controller
|
|||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('database_errors')->error($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
abort(400, 'Database error');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class StatisticsMessageController extends Controller
|
|||
try {
|
||||
return $statisticsMessage->saveOrFail();
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('database_errors')->error($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
abort(400, 'Database error');
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class StatisticsMessageController extends Controller
|
|||
['last_status' => $request->get('last_status'), 'received_at' => $request->get('received_at')]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('database_errors')->error($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
abort(400, 'Database error');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class OvhSMS
|
|||
$this->smsService = $smsServices[0];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('events')->info('OVH SMS API unreachable, check the errors log');
|
||||
Log::info('OVH SMS API unreachable, check the errors log');
|
||||
Log::error('OVH SMS API not reachable: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ class OvhSMS
|
|||
'validityPeriod' => 2880
|
||||
];
|
||||
|
||||
Log::channel('events')->info('OVH SMS sending', ['to' => $to, 'message' => $message]);
|
||||
Log::info('OVH SMS sending', ['to' => $to, 'message' => $message]);
|
||||
|
||||
try {
|
||||
$this->api->post('/sms/'. $this->smsService . '/jobs', $content);
|
||||
|
|
@ -80,7 +80,7 @@ class OvhSMS
|
|||
|
||||
$this->api->get('/sms/'. $this->smsService . '/jobs');
|
||||
} catch (\Exception $e) {
|
||||
Log::channel('events')->info('OVH SMS not sent, check the errors log');
|
||||
Log::info('OVH SMS not sent, check the errors log');
|
||||
Log::error('OVH SMS not sent: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ class AccountService
|
|||
$token->account_id = $account->id;
|
||||
$token->save();
|
||||
|
||||
Log::channel('events')->info('API: AccountCreationToken redeemed', ['account_creation_token' => $token->toLog()]);
|
||||
Log::info('API: AccountCreationToken redeemed', ['account_creation_token' => $token->toLog()]);
|
||||
}
|
||||
|
||||
Log::channel('events')->info(
|
||||
Log::info(
|
||||
$request->asAdmin
|
||||
? 'Account Service as Admin: Account created'
|
||||
: 'Account Service: Account created',
|
||||
|
|
@ -176,7 +176,7 @@ class AccountService
|
|||
}
|
||||
}
|
||||
|
||||
Log::channel('events')->info(
|
||||
Log::info(
|
||||
$request->asAdmin
|
||||
? 'Account Service as Admin: Account updated'
|
||||
: 'Account Service: Account updated',
|
||||
|
|
@ -206,7 +206,7 @@ class AccountService
|
|||
(new FlexisipRedisConnector)->pingB2BUA($externalAccount);
|
||||
}
|
||||
|
||||
Log::channel('events')->info(
|
||||
Log::info(
|
||||
'Account Service: Account destroyed',
|
||||
['id' => $account->identifier]
|
||||
);
|
||||
|
|
@ -239,7 +239,7 @@ class AccountService
|
|||
$phoneChangeCode->fillRequestInfo($request);
|
||||
$phoneChangeCode->save();
|
||||
|
||||
Log::channel('events')->info('Account Service: Account phone change requested by SMS', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Account phone change requested by SMS', ['id' => $account->identifier]);
|
||||
|
||||
$message = 'Your ' . $account->space->name . ' validation code is ' . $phoneChangeCode->code . '.';
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ class AccountService
|
|||
$account->activated = true;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('Account Service: Account phone changed using SMS', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Account phone changed using SMS', ['id' => $account->identifier]);
|
||||
|
||||
$account->refresh();
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ class AccountService
|
|||
$emailChangeCode->fillRequestInfo($request);
|
||||
$emailChangeCode->save();
|
||||
|
||||
Log::channel('events')->info('Account Service: Account email change requested by email', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Account email change requested by email', ['id' => $account->identifier]);
|
||||
|
||||
Mail::to($emailChangeCode->email)->send(new RegisterValidation($account));
|
||||
}
|
||||
|
|
@ -349,7 +349,7 @@ class AccountService
|
|||
$account->email = $emailChangeCode->email;
|
||||
$account->save();
|
||||
|
||||
Log::channel('events')->info('Account Service: Account email changed using email', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Account email changed using email', ['id' => $account->identifier]);
|
||||
|
||||
$emailChangeCode->consume();
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ class AccountService
|
|||
|
||||
Mail::to($account)->send(new RecoverByCode($account));
|
||||
|
||||
Log::channel('events')->info('Account Service: Sending recovery email', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Sending recovery email', ['id' => $account->identifier]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
@ -400,13 +400,13 @@ class AccountService
|
|||
$ovhSMS = new OvhSMS();
|
||||
$ovhSMS->send($account->phone, $message);
|
||||
|
||||
Log::channel('events')->info('Account Service: Sending recovery SMS', ['id' => $account->identifier]);
|
||||
Log::info('Account Service: Sending recovery SMS', ['id' => $account->identifier]);
|
||||
|
||||
$accountRecoveryToken->consume();
|
||||
$accountRecoveryToken->account_id = $account->id;
|
||||
$accountRecoveryToken->save();
|
||||
|
||||
Log::channel('events')->info('API: AccountRecoveryToken redeemed', ['account_recovery_token' => $accountRecoveryToken->toLog()]);
|
||||
Log::info('API: AccountRecoveryToken redeemed', ['account_recovery_token' => $accountRecoveryToken->toLog()]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,57 +35,12 @@ return [
|
|||
*/
|
||||
|
||||
'channels' => [
|
||||
'events' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/events.log'),
|
||||
'level' => 'info',
|
||||
'days' => 30
|
||||
],
|
||||
|
||||
'database_errors' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/database_errors.log'),
|
||||
'level' => 'error',
|
||||
'days' => 30
|
||||
],
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => 'critical',
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => StreamHandler::class,
|
||||
|
|
@ -99,16 +54,6 @@ return [
|
|||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue