PHPackages                             tailstream-io/laravel-logger - 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. tailstream-io/laravel-logger

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

tailstream-io/laravel-logger
============================

A beautiful Laravel log driver package with performance monitoring, request tracking, and cache-based batching

v1.0(7mo ago)10MITPHPPHP ^8.3CI passing

Since Sep 27Pushed 7mo agoCompare

[ Source](https://github.com/tailstream-io/tailstream-laravel)[ Packagist](https://packagist.org/packages/tailstream-io/laravel-logger)[ RSS](/packages/tailstream-io-laravel-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (2)Used By (0)

Tailstream Laravel Logger
=========================

[](#tailstream-laravel-logger)

A beautiful Laravel log driver package with performance monitoring, request tracking, and cache-based batching capabilities. Built with Laravel 12+ compatibility and following convention over configuration principles.

About Tailstream
----------------

[](#about-tailstream)

[Tailstream](https://tailstream.io) is a modern log aggregation and monitoring platform designed for developers who need powerful observability without the complexity. It provides real-time log streaming, intelligent alerting, and beautiful dashboards to help you monitor your applications effectively.

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

[](#-features)

- 🚀 **Minimal Configuration** - Works with just basic setup
- ⚡ **Performance Monitoring** - Track response times and memory usage
- 🔗 **Request Correlation** - UUID-based request tracking across your application
- 📦 **Smart Batching** - Cache-based log batching with configurable thresholds
- 🚀 **Queue Support** - Optional asynchronous processing via Laravel queues
- 🎯 **Tailstream Integration** - Direct integration with Tailstream API
- 🛡️ **Laravel 12 Native** - Built using Laravel 12's modern patterns and conventions
- 🧪 **Comprehensive Tests** - Full Pest test suite with 100% coverage

🚀 Installation
--------------

[](#-installation)

```
composer require tailstream-io/laravel-logger
```

### Configure Stream Credentials

[](#configure-stream-credentials)

Add your stream credentials to your `.env` file:

```
TAILSTREAM_STREAM_UUID=your-stream-uuid
TAILSTREAM_STREAM_SECRET=your-stream-secret
```

That's it! The package will automatically:

- Register itself via Laravel's package discovery
- Add global middleware to track all requests
- Start sending request data to Tailstream immediately

📋 Quick Start
-------------

[](#-quick-start)

Your application is now automatically sending request data to Tailstream! All HTTP requests will be tracked and batched for efficient delivery.

⚙️ Configuration
----------------

[](#️-configuration)

While the package requires minimal configuration to get started, you can customize it further:

```
php artisan vendor:publish --tag=tailstream-logger-config
```

### Environment Variables

[](#environment-variables)

```
# Basic Settings
TAILSTREAM_ENABLED=true
TAILSTREAM_BASE_URL=https://app.tailstream.io/api
TAILSTREAM_SAMPLING_RATE=1.0
TAILSTREAM_INSTANCE_ID=web-01

# Batching Configuration
TAILSTREAM_BATCH_SIZE=50          # Flush when batch reaches this size
TAILSTREAM_FLUSH_FREQUENCY=10     # Flush every N requests
TAILSTREAM_CACHE_TTL=3600

# Queue Configuration (Optional)
TAILSTREAM_USE_QUEUE=false        # Enable asynchronous processing
TAILSTREAM_QUEUE_NAME=tailstream   # Queue name for processing
TAILSTREAM_QUEUE_CONNECTION=       # Queue connection (default: app default)

# Middleware
TAILSTREAM_AUTO_MIDDLEWARE=true
```

📊 What Gets Logged
------------------

[](#-what-gets-logged)

Data is sent in batches to the Tailstream ingest endpoint (`https://app.tailstream.io/api/ingest/{stream_uuid}`) with Bearer token authentication using NDJSON format:

```
{"ts":"2024-03-15T10:30:45.123456+00:00","host":"web-01","path":"/api/users","method":"GET","status":200,"rt":0.245,"bytes":1024,"src":"192.168.1.100"}
{"ts":"2024-03-15T10:31:12.789012+00:00","host":"web-01","path":"/api/posts","method":"POST","status":201,"rt":0.156,"bytes":512,"src":"192.168.1.101"}

```

### Field Descriptions

[](#field-descriptions)

- **ts**: ISO 8601 timestamp when the request was processed
- **host**: Server hostname where the request was handled
- **path**: Request path (without query parameters)
- **method**: HTTP method (GET, POST, etc.)
- **status**: HTTP response status code
- **rt**: Response time in seconds
- **bytes**: Response size in bytes
- **src**: Client IP address

🔧 Advanced Configuration
------------------------

[](#-advanced-configuration)

### Queue-Based Processing

[](#queue-based-processing)

For high-traffic applications, you can enable asynchronous processing using Laravel queues. This prevents the HTTP request from being blocked while logs are sent to Tailstream:

```
TAILSTREAM_USE_QUEUE=true
TAILSTREAM_QUEUE_NAME=tailstream
TAILSTREAM_QUEUE_CONNECTION=redis
```

When queue processing is enabled:

- Log batches are dispatched to the specified queue instead of being sent synchronously
- The queue job includes retry logic (3 attempts with 60-second backoff)
- Your queue workers will handle the actual transmission to Tailstream
- This reduces request latency and provides better fault tolerance

**Requirements:**

- Ensure your queue system is properly configured and running
- Queue workers must be active to process the jobs
- Consider using a reliable queue driver like Redis or database for production

### Sampling for High-Traffic Apps

[](#sampling-for-high-traffic-apps)

```
'sampling_rate' => 0.1, // Log 10% of requests
```

### Exclude Specific Paths

[](#exclude-specific-paths)

```
'excluded_paths' => [
    'telescope/*',
    'horizon/*',
    '_ignition/*',
    'health-check',
    'up',
    'favicon.ico',
    '*.css',
    '*.js',
    '*.map',
    'storage/*',
],
```

🧪 Testing
---------

[](#-testing)

```
composer test
```

📚 Laravel Integration
---------------------

[](#-laravel-integration)

### Middleware Registration

[](#middleware-registration)

The package automatically registers middleware globally. To disable:

```
'auto_register_middleware' => false,
```

Then manually register:

```
// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
    $middleware->append(TailstreamLogger::class);
})
```

🔍 Monitoring &amp; Debugging
----------------------------

[](#-monitoring--debugging)

### Request Correlation

[](#request-correlation)

Every request gets a unique UUID that's included in all logs during that request, making it easy to trace issues across your application.

📈 Batching Strategy
-------------------

[](#-batching-strategy)

- **Batch Size**: Process when 50 entries are collected (configurable)
- **Periodic Flush**: Process every 10 requests to prevent logs sitting too long (configurable)
- **Cache-Based**: Uses your configured cache driver (Redis recommended)
- **Queue Support**: Optional asynchronous processing for high-traffic applications

🔧 Management Commands
---------------------

[](#-management-commands)

The package includes artisan commands for batch management:

```
# Check batch status
php artisan tailstream:flush --status

# Manually flush pending logs
php artisan tailstream:flush

# Clear batch without processing
php artisan tailstream:flush --clear
```

📝 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

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

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

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

[](#-bug-reports)

If you discover a bug, please open an issue on [GitHub](https://github.com/tailstream/laravel-logger/issues).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance63

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95f389d71b88d1dcfafbe056d502bf8353a2a5e41b7106a9dc1e475f964a38f8?d=identicon)[ArondeParon](/maintainers/ArondeParon)

---

Top Contributors

[![arondeparon](https://avatars.githubusercontent.com/u/7697?v=4)](https://github.com/arondeparon "arondeparon (1 commits)")

---

Tags

middlewarelaravelloggingmonitoringperformance

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tailstream-io-laravel-logger/health.svg)

```
[![Health](https://phpackages.com/badges/tailstream-io-laravel-logger/health.svg)](https://phpackages.com/packages/tailstream-io-laravel-logger)
```

###  Alternatives

[naoray/laravel-github-monolog

Log driver to store logs as github issues

10619.4k](/packages/naoray-laravel-github-monolog)[shaffe/laravel-mail-log-channel

A package to support logging via email in Laravel

1286.2k](/packages/shaffe-laravel-mail-log-channel)

PHPackages © 2026

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