PHPackages                             ody/influxdb - 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. ody/influxdb

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

ody/influxdb
============

InfluxDB 2.x logging integration for ODY Framework

0.1.0(1y ago)06MITPHPPHP &gt;=8.3

Since Mar 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ody-dev/InfluxDB)[ Packagist](https://packagist.org/packages/ody/influxdb)[ RSS](/packages/ody-influxdb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

InfluxDB2 Logger for ODY Framework
==================================

[](#influxdb2-logger-for-ody-framework)

⚠️ **IMPORTANT**: This repository is automatically generated from the [ody repo](https://github.com/ody-dev/ody) and is read-only.

A custom logging solution for ODY Framework that stores logs in InfluxDB 2.x.

Installation
------------

[](#installation)

```
composer require ody/influxdb
```

Configuration
-------------

[](#configuration)

### Register the Service Provider

[](#register-the-service-provider)

Add the InfluxDB2 service provider to your `config/app.php` configuration:

```
'providers' => [
    // Other providers
    InfluxDB\Logging\InfluxDB2ServiceProvider::class,
],
```

### Configure the Logger

[](#configure-the-logger)

Add an InfluxDB channel to your `config/logging.php` configuration:

```
'channels' => [
    // Other channels...

    'influxdb' => [
        'driver' => 'influxdb',
        'url' => env('INFLUXDB_URL', 'http://127.0.0.1:8086'),
        'token' => env('INFLUXDB_TOKEN', ''),
        'org' => env('INFLUXDB_ORG', 'organization'),
        'bucket' => env('INFLUXDB_BUCKET', 'logs'),
        'measurement' => env('INFLUXDB_MEASUREMENT', 'logs'),
        'level' => env('INFLUXDB_LOG_LEVEL', 'debug'),
        'use_coroutines' => env('INFLUXDB_USE_COROUTINES', false),
        'tags' => [
            'service' => env('APP_NAME', 'ody-service'),
            'environment' => env('APP_ENV', 'production'),
            'instance' => env('INSTANCE_ID', gethostname()),
        ],
    ],

    // Optional: Add to stack to log to multiple destinations
    'production' => [
        'driver' => 'group',
        'channels' => ['file', 'influxdb'],
    ],
],
```

### Environment Variables

[](#environment-variables)

Configure the following environment variables in your `.env` file:

```
INFLUXDB_URL=http://localhost:8086
INFLUXDB_TOKEN=your_token_here
INFLUXDB_ORG=your_org
INFLUXDB_BUCKET=logs
INFLUXDB_LOG_LEVEL=debug
INFLUXDB_USE_COROUTINES=false

```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
// Log to InfluxDB channel
logger('User registered', ['user_id' => 123], 'influxdb');

// Or configure influxdb as your default channel in config/logging.php
// and use logger normally
logger('System started');
```

### Using Tags for Better Querying

[](#using-tags-for-better-querying)

```
// Log with custom tags
logger('API request processed', [
    'duration' => 120,
    'endpoint' => '/users',
    'tags' => [
        'module' => 'api',
        'method' => 'GET',
        'status' => 200
    ]
], 'influxdb');
```

### Dependency Injection

[](#dependency-injection)

```
use Psr\Log\LoggerInterface;

class UserService
{
    protected $logger;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;
    }

    public function registerUser($data)
    {
        // Register user logic...

        $this->logger->info('User registered', [
            'id' => $user->id,
            'email' => $user->email
        ]);
    }
}
```

Advanced Configuration
----------------------

[](#advanced-configuration)

### Using with Swoole Coroutines

[](#using-with-swoole-coroutines)

For high-performance applications using Swoole, enable coroutines to make logging non-blocking:

```
'influxdb' => [
    // ...other config
    'use_coroutines' => true,
],
```

This will use Swoole coroutines to perform writes to InfluxDB asynchronously, preventing your application from blocking during log writes.

### Custom Measurement Names

[](#custom-measurement-names)

You can specify a custom measurement name:

```
'influxdb' => [
    // ...other config
    'measurement' => 'application_logs',
],
```

### Grouping Related Logs

[](#grouping-related-logs)

You can group related logs by adding the same tag values:

```
$requestId = uniqid();

logger('Request started', [
    'tags' => ['request_id' => $requestId]
]);

// Later in the code
logger('Database query executed', [
    'query' => 'SELECT * FROM users',
    'duration' => 25,
    'tags' => ['request_id' => $requestId]
]);

// And finally
logger('Request completed', [
    'duration' => 150,
    'tags' => ['request_id' => $requestId]
]);
```

This allows you to query InfluxDB for all logs related to a specific request.

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

407d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/984734252c6b932be5ef737920c3d0f792283664e75ba405f3df268cc1da138c?d=identicon)[IlyasDeckers](/maintainers/IlyasDeckers)

---

Top Contributors

[![IlyasDeckers](https://avatars.githubusercontent.com/u/18727603?v=4)](https://github.com/IlyasDeckers "IlyasDeckers (20 commits)")

---

Tags

loggingMetricsinfluxdbtime seriesInfluxDB2ody

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ody-influxdb/health.svg)

```
[![Health](https://phpackages.com/badges/ody-influxdb/health.svg)](https://phpackages.com/packages/ody-influxdb)
```

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[beberlei/metrics

Simple library to talk to metrics collector services.

3251.2M4](/packages/beberlei-metrics)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[friendsofopentelemetry/opentelemetry-bundle

Traces, metrics, and logs instrumentation within your Symfony application

638.6k](/packages/friendsofopentelemetry-opentelemetry-bundle)

PHPackages © 2026

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