PHP code example of osit / laravel-log-sentinel

1. Go to this page and download the library: Download osit/laravel-log-sentinel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

osit / laravel-log-sentinel example snippets


'enabled' => env('LOG_SENTINEL_ENABLED', true),

'route_prefix' => env('LOG_SENTINEL_ROUTE_PREFIX', 'admin/log-sentinel'),

'middleware' => ['web', 'auth'],

'path_security' => [
    'allow_only_configured_paths' => true,
    'allowed_base_paths' => [
        storage_path('logs'),
        '/var/log',
        '/var/log/apache2',
        '/var/log/nginx',
        '/var/log/mysql',
        '/var/log/postgresql',
    ],
],

use Illuminate\Support\Facades\Schedule;

Schedule::command('log-sentinel:scan')->everyFiveMinutes();
Schedule::command('log-sentinel:prune')->dailyAt('02:00');

'middleware' => ['web', 'auth'],

'middleware' => ['web', 'auth', 'can:access-admin'],

'middleware' => ['web', 'auth', 'role:admin'],

'path_security' => [
    'allow_only_configured_paths' => true,

    'allowed_base_paths' => [
        storage_path('logs'),
        '/var/log',
        '/var/log/apache2',
        '/var/log/nginx',
        '/var/log/mysql',
        '/var/log/postgresql',
    ],
],

'retention' => [
    'default_log_days' => 30,
    'resolved_alert_days' => 90,
    'keep_entries_with_open_alerts' => true,
    'prune_chunk_size' => 500,
],
bash
php artisan log-sentinel:install
bash
php artisan migrate
bash
php artisan vendor:publish --tag=log-sentinel-config
bash
php artisan log-sentinel:detect-alerts --limit=5000
bash
php artisan log-sentinel:install
bash
php artisan log-sentinel:detect-alerts --limit=5000
bash
php artisan log-sentinel:prune
bash
php artisan log-sentinel:prune --days=7 --dry-run
bash
php artisan vendor:publish --tag=log-sentinel-views
bash
php artisan vendor:publish --tag=log-sentinel-migrations