PHPackages                             falahatiali/laravel-advance-log-monitoring - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. falahatiali/laravel-advance-log-monitoring

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

falahatiali/laravel-advance-log-monitoring
==========================================

🦅 Simorgh Logger - Advanced log monitoring package for Laravel with dashboard, alerts, and intelligent categorization. Named after the legendary Persian bird.

v1.0.2(7mo ago)25MITPHPPHP ^8.1

Since Oct 6Pushed 7mo agoCompare

[ Source](https://github.com/falahatiali/laravel-advance-log-monitoring)[ Packagist](https://packagist.org/packages/falahatiali/laravel-advance-log-monitoring)[ Docs](https://github.com/falahatiali/laravel-advance-log-monitoring)[ RSS](/packages/falahatiali-laravel-advance-log-monitoring/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

 [![Simorgh Logger](public/simorgh.png)](public/simorgh.png)🦅 Simorgh Logger for Laravel
============================

[](#-simorgh-logger-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/053528f83779c8598f3b906576c0f15e6391c1cf1a7481ede5c900cf4206cb20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66616c6168617469616c692f73696d6f7267682d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/falahatiali/simorgh-logger)[![Total Downloads](https://camo.githubusercontent.com/e2ddcdfb07c8fb70db47e7ad944f52b453766db1fbd4ff8b340e2de6a6e71be9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66616c6168617469616c692f73696d6f7267682d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/falahatiali/simorgh-logger)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Repository](https://camo.githubusercontent.com/6a5c8e5f5438975ae7b78344cbdb41c713d15e52064a06035c5120f13dd281f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d6c61726176656c2d2d616476616e63652d2d6c6f672d2d6d6f6e69746f72696e672d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/falahatiali/laravel-advance-log-monitoring)

🦅 **Simorgh Logger** - A powerful and feature-rich logging package for Laravel applications with dashboard, alerts, and intelligent categorization. Named after the legendary Persian bird that watches over and protects all under its wings.

> *"Just as the mythical Simorgh watches over all birds under its wings, this package watches over and protects all your application logs."*

✨ Features
----------

[](#-features)

- 🎯 **Smart Categorization** - Organize logs by modules (auth, api, payments, etc.)
- 📊 **Visual Dashboard** - Beautiful web interface with real-time updates
- 🚨 **Automated Alerts** - Email, Slack, Telegram notifications with intelligent triggers
- 🔍 **Advanced Filtering** - Search and filter logs with powerful query builder
- 📈 **Analytics &amp; Stats** - Comprehensive statistics and performance metrics
- 🔒 **Security** - Automatic sanitization of sensitive data
- 📁 **Multiple Storage** - Database, File, Sentry, Elasticsearch support
- 🎨 **Export Options** - JSON, CSV, XML export capabilities
- ⚡ **Performance** - Queue support and optimized queries
- 🧹 **Auto Cleanup** - Configurable retention policies

🎮 Try Live Demo
---------------

[](#-try-live-demo)

Want to see Simorgh Logger in action before installing? Try our demo!

### Quick Demo (One Command)

[](#quick-demo-one-command)

```
git clone https://github.com/falahatiali/laravel-advance-log-monitoring.git
cd laravel-advance-log-monitoring
chmod +x demo.sh && ./demo.sh
```

Then visit: ****

### Docker Demo (No PHP Required)

[](#docker-demo-no-php-required)

```
git clone https://github.com/falahatiali/laravel-advance-log-monitoring.git
cd laravel-advance-log-monitoring
docker-compose up -d
```

Visit: ****

📖 Full demo guide: [DEMO.md](DEMO.md)

---

📦 Installation
--------------

[](#-installation)

### Composer

[](#composer)

```
composer require falahatiali/simorgh-logger
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

The package will automatically register itself. If auto-discovery is disabled, add the service provider to your `config/app.php`:

```
'providers' => [
    // ...
    Simorgh\Logger\SimorghLoggerServiceProvider::class,
],
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --provider="Simorgh\Logger\SimorghLoggerServiceProvider" --tag="simorgh-logger-config"
```

### Publish Migrations

[](#publish-migrations)

```
php artisan vendor:publish --provider="Simorgh\Logger\SimorghLoggerServiceProvider" --tag="simorgh-logger-migrations"
```

### Run Migrations

[](#run-migrations)

```
php artisan migrate
```

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage

[](#basic-usage)

```
use Simorgh\Logger\Facades\Simorgh;

// Simple logging
Simorgh::info('Application started successfully');

// With context
Simorgh::error('Payment failed', [
    'user_id' => 123,
    'amount' => 99.99,
    'payment_method' => 'credit_card'
]);

// Categorized logging
Simorgh::category('auth')
    ->warning('Failed login attempt', [
        'email' => 'user@example.com',
        'ip' => request()->ip()
    ]);
```

### Advanced Usage

[](#advanced-usage)

```
// Chainable methods
Simorgh::category('api')
    ->user(auth()->id())
    ->context(['request_id' => Str::uuid()])
    ->error('API rate limit exceeded', [
        'endpoint' => '/api/users',
        'limit' => 100,
        'current' => 150
    ]);

// Performance logging
Simorgh::performance('Database query', 0.250, [
    'query' => 'SELECT * FROM users WHERE...',
    'rows' => 1500
]);

// Security events
Simorgh::security('Suspicious activity detected', [
    'type' => 'multiple_failed_logins',
    'ip' => request()->ip(),
    'user_agent' => request()->userAgent()
]);

// Exception logging
try {
    // Some risky operation
} catch (\Exception $e) {
    Simorgh::exception($e, [
        'context' => 'Payment processing',
        'user_id' => auth()->id()
    ]);
}
```

📊 Dashboard
-----------

[](#-dashboard)

Access the dashboard at `/simorgh-logger` (or your configured prefix).

### Features:

[](#features)

- Real-time log monitoring
- Advanced filtering and search
- Log statistics and charts
- Alert management
- Export functionality
- Settings configuration

### Dashboard Routes:

[](#dashboard-routes)

- `/simorgh-logger` - Main dashboard
- `/simorgh-logger/logs` - Log browser
- `/simorgh-logger/stats` - Statistics
- `/simorgh-logger/alerts` - Alert management
- `/simorgh-logger/settings` - Configuration

### 📸 Dashboard Screenshots

[](#-dashboard-screenshots)

#### Main Dashboard

[](#main-dashboard)

[![Main Dashboard](public/demo1.png)](public/demo1.png)*Real-time overview with statistics, log distribution charts, and recent log entries*

#### All Logs Browser

[](#all-logs-browser)

[![All Logs](public/demo2.png)](public/demo2.png)*Advanced filtering, search capabilities, and export options (JSON, CSV, XML)*

#### Statistics &amp; Analytics

[](#statistics--analytics)

[![Statistics](public/demo3.png)](public/demo3.png)*Comprehensive insights with date range filters, distribution charts, and trend analysis*

#### Alert Configuration

[](#alert-configuration)

[![Alerts](public/demo4.png)](public/demo4.png)*Configure alert channels (Email, Slack, Telegram) and threshold settings*

🚨 Alerts Configuration
----------------------

[](#-alerts-configuration)

### Email Alerts

[](#email-alerts)

```
// config/simorgh-logger.php
'alerts' => [
    'enabled' => true,
    'channels' => [
        'email' => [
            'enabled' => true,
            'to' => 'admin@example.com',
            'subject_prefix' => '[Simorgh Alert]',
        ],
    ],
    'thresholds' => [
        'critical' => [
            'count' => 5,
            'time_window' => '1 hour',
        ],
    ],
],
```

### Slack Alerts

[](#slack-alerts)

```
'alerts' => [
    'channels' => [
        'slack' => [
            'enabled' => true,
            'webhook' => 'https://hooks.slack.com/services/...',
            'channel' => '#alerts',
        ],
    ],
],
```

### Telegram Alerts

[](#telegram-alerts)

```
'alerts' => [
    'channels' => [
        'telegram' => [
            'enabled' => true,
            'bot_token' => '123456789:ABCdefGHIjklMNOpqrsTUVwxyz',
            'chat_id' => '-123456789',
        ],
    ],
],
```

🔧 Configuration
---------------

[](#-configuration)

### Environment Variables

[](#environment-variables)

```
# Enable/disable Simorgh Logger
SIMORGH_LOGGER_ENABLED=true

# Storage driver (database, file, sentry, elasticsearch)
LOG_STORAGE_DRIVER=database

# Alert settings
LOG_ALERTS_ENABLED=true
LOG_ALERT_EMAIL_ENABLED=true
LOG_ALERT_EMAIL_TO=admin@example.com
LOG_ALERT_SLACK_ENABLED=true
LOG_ALERT_SLACK_WEBHOOK=https://hooks.slack.com/services/...

# Dashboard settings
LOG_DASHBOARD_ENABLED=true
LOG_DASHBOARD_PREFIX=advanced-logger
LOG_DASHBOARD_REALTIME=true

# Auto-logging
LOG_AUTO_REQUESTS=true
LOG_AUTO_MODELS=false
LOG_AUTO_QUERIES=false

# Performance
LOG_USE_QUEUE=false
LOG_RETENTION_ENABLED=true
LOG_RETENTION_DAYS=30
```

### Custom Route Prefix &amp; Middleware

[](#custom-route-prefix--middleware)

You can customize the route prefix and middleware for the dashboard:

**Option 1: Using Environment Variables**

```
# Custom route prefix (default: advanced-logger)
LOG_DASHBOARD_PREFIX=admin/dashboard/logs/panel
```

**Option 2: Using Config File**

```
// config/advanced-logger.php
'dashboard' => [
    'enabled' => true,
    'prefix' => 'admin/dashboard/logs/panel', // Custom prefix
    'middleware' => ['web', 'auth', 'role:admin'], // Add your middleware
    // ...
],
```

**Examples:**

ConfigurationResulting URL`prefix => 'advanced-logger'``mysite.com/advanced-logger``prefix => 'admin/logs'``mysite.com/admin/logs``prefix => 'admin/dashboard/logs/panel'``mysite.com/admin/dashboard/logs/panel`**Middleware Examples:**

```
// Basic authentication only
'middleware' => ['web', 'auth'],

// With role-based access (Spatie Permission)
'middleware' => ['web', 'auth', 'role:admin'],

// With permission-based access
'middleware' => ['web', 'auth', 'permission:view-logs'],

// Multiple roles
'middleware' => ['web', 'auth', 'role:admin|developer'],

// Custom middleware
'middleware' => ['web', 'auth', 'custom.admin'],
```

### Auto-Logging Middleware

[](#auto-logging-middleware)

Add to your `app/Http/Kernel.php`:

```
protected $middleware = [
    // ...
    \Simorgh\Logger\Middleware\LogRequestsMiddleware::class,
];
```

📈 Statistics &amp; Analytics
----------------------------

[](#-statistics--analytics)

```
// Get comprehensive stats
$stats = Simorgh::getStats();

// Get stats with filters
$stats = Simorgh::getStats([
    'level' => ['error', 'critical'],
    'date_from' => '2025-01-01',
    'date_to' => '2025-01-31'
]);

// Get logs with pagination
$logs = Simorgh::getLogs([
    'category' => 'auth',
    'search' => 'login'
], 50);
```

📤 Export &amp; Cleanup
----------------------

[](#-export--cleanup)

### Export Logs

[](#export-logs)

```
// Export as JSON
$json = Simorgh::exportLogs(['level' => 'error'], 'json');

// Export as CSV
$csv = Simorgh::exportLogs(['category' => 'auth'], 'csv');

// Export as XML
$xml = Simorgh::exportLogs(['date_from' => '2025-01-01'], 'xml');
```

### Cleanup Commands

[](#cleanup-commands)

The package includes a powerful cleanup command that automatically removes old logs:

```
# Cleanup logs older than 30 days (uses config default)
php artisan logs:cleanup

# Cleanup logs older than specific number of days
php artisan logs:cleanup --days=30

# Cleanup only specific level
php artisan logs:cleanup --level=error

# Cleanup only specific category
php artisan logs:cleanup --category=auth

# Dry run (see what would be deleted without actually deleting)
php artisan logs:cleanup --dry-run

# Compress logs before deletion (saves backup)
php artisan logs:cleanup --compress
```

### Automatic Cleanup (Cron Job)

[](#automatic-cleanup-cron-job)

**The cleanup command runs automatically!** No manual setup needed. 🎉

By default, it runs **daily at 2 AM** and removes logs older than:

- **7 days** in `local` environment
- **14 days** in `staging` environment
- **30 days** in `production` environment

**Customize the schedule:**

```
# .env
LOG_RETENTION_ENABLED=true
LOG_RETENTION_DAYS=30  # Not used by auto-scheduler, but by manual command
```

```
// config/advanced-logger.php
'retention' => [
    'enabled' => true,
    'days' => [
        'local' => 7,
        'staging' => 14,
        'production' => 30,  // Delete logs older than 30 days
    ],
    'compress_before_delete' => true,
    'cleanup_schedule' => '0 2 * * *', // Daily at 2 AM (cron expression)
],
```

**Custom cron schedules:**

ExpressionDescription`0 2 * * *`Daily at 2:00 AM (default)`0 0 * * 0`Weekly on Sunday at midnight`0 3 * * 1`Every Monday at 3:00 AM`*/30 * * * *`Every 30 minutes`0 */6 * * *`Every 6 hours**Important:** Make sure Laravel's scheduler is running:

```
# Add to your crontab (crontab -e)
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
```

### Manual Cleanup

[](#manual-cleanup)

You can also run cleanup manually at any time:

```
# Clean up now using environment defaults
php artisan logs:cleanup

# Force cleanup of logs older than 1 month
php artisan logs:cleanup --days=30

# Test what would be deleted first
php artisan logs:cleanup --days=30 --dry-run
```

🔒 Security Features
-------------------

[](#-security-features)

### Automatic Sanitization

[](#automatic-sanitization)

The package automatically sanitizes sensitive data:

```
// These will be automatically masked
Simorgh::info('User data', [
    'password' => 'secret123',        // → '[REDACTED]'
    'api_token' => 'abc123',         // → '[REDACTED]'
    'credit_card' => '4111111111111111', // → '[REDACTED]'
    'ssn' => '123-45-6789',          // → '[REDACTED]'
]);
```

### Custom Sanitization Patterns

[](#custom-sanitization-patterns)

```
// config/simorgh-logger.php
'security' => [
    'sensitive_patterns' => [
        '/password/i',
        '/token/i',
        '/secret/i',
        '/key/i',
        '/credit_card/i',
        '/ssn/i',
        '/social_security/i',
        '/my_custom_field/i',  // Add your own patterns
    ],
    'mask_replacement' => '[REDACTED]',
],
```

🎯 Categories
------------

[](#-categories)

Predefined categories for better organization:

- `auth` - Authentication &amp; Authorization
- `api` - API Requests &amp; Responses
- `payments` - Payment Processing
- `database` - Database Operations
- `mail` - Email Operations
- `queue` - Queue Processing
- `cache` - Cache Operations
- `file` - File Operations
- `security` - Security Events
- `performance` - Performance Monitoring
- `debug` - Debug Information

🔌 Integrations
--------------

[](#-integrations)

### Sentry Integration

[](#sentry-integration)

```
'integrations' => [
    'sentry' => [
        'enabled' => true,
        'dsn' => env('SENTRY_LARAVEL_DSN'),
    ],
],
```

### Elasticsearch Integration

[](#elasticsearch-integration)

```
'integrations' => [
    'elasticsearch' => [
        'enabled' => true,
        'host' => env('ELASTICSEARCH_HOST', 'localhost:9200'),
        'index' => env('ELASTICSEARCH_LOG_INDEX', 'laravel-logs'),
    ],
],
```

🧪 Testing
---------

[](#-testing)

```
# Run tests
composer test

# Run with coverage
composer test-coverage
```

### Testing in Your Application

[](#testing-in-your-application)

```
// Test logging
Simorgh::shouldReceive('error')->once()->with('Test message', []);
Simorgh::error('Test message', []);

// Test alerts
$alertHandler = app(\Simorgh\Logger\Handlers\AlertHandler::class);
$results = $alertHandler->testChannels();
```

📝 Changelog
-----------

[](#-changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

🐛 Bug Reports
-------------

[](#-bug-reports)

If you discover a security vulnerability, please send an email to [falaahatiali@gmail.com](mailto:your-email@example.com). All security vulnerabilities will be promptly addressed.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

🙏 Credits
---------

[](#-credits)

- [Falahati Ali](https://github.com/falahatiali) - Creator and maintainer
- [All Contributors](https://github.com/falahatiali/laravel-advance-log-monitoring/contributors) - Contributors

📚 Additional Resources
----------------------

[](#-additional-resources)

- [Installation Guide](INSTALLATION.md) - Complete setup guide
- [Integration Guide](INTEGRATION.md) - Integrate with existing admin panels
- [Laravel Logging Documentation](https://laravel.com/docs/logging)
- [Monolog Documentation](https://github.com/Seldaek/monolog)
- [Laravel Package Development](https://laravel.com/docs/packages)

---

**Made with ❤️ and 🦅 for the Laravel community**

> *"Just as the mythical Simorgh watches over all birds under its wings, this package watches over and protects all your application logs."*

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance64

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

218d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/068d2c8e404562d237d85728d61e51c7083afae3e806b44fb35cac6f37acb628?d=identicon)[falahatiali](/maintainers/falahatiali)

---

Top Contributors

[![falahatiali](https://avatars.githubusercontent.com/u/17930523?v=4)](https://github.com/falahatiali "falahatiali (34 commits)")

---

Tags

laravellogsphpmiddlewarecomposerlaravelloggingmonitoringpackagesecurityreal-timealertsdashboardanalyticspersiansimorgh

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/falahatiali-laravel-advance-log-monitoring/health.svg)

```
[![Health](https://phpackages.com/badges/falahatiali-laravel-advance-log-monitoring/health.svg)](https://phpackages.com/packages/falahatiali-laravel-advance-log-monitoring)
```

###  Alternatives

[muhammadsadeeq/laravel-activitylog-ui

A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.

17510.1k](/packages/muhammadsadeeq-laravel-activitylog-ui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
