Get support for we-push-it/yii2-splunk-log-target

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

we-push-it/yii2-splunk-log-target

yii2-splunk-log-target

Allows you to to send logs to your Splunk Enterprise.

Installation

composer require "we-push-it/yii2-splunk-log-target"

Usage

In order to use SplunkTarget you should configure your log application component like the following:

return [
    // ...
    'bootstrap' => ['log'],    
    // ...    
    'components' => [
        // ...        
        'log' => [
            'targets' => [
                [
                    'class' => wepushit\log\SplunkTarget::class,
                    
                    // It is optional parameter. The message levels that this target is interested in.
                    // The parameter can be an array.
                    'levels' => ['error', 'warning'],
                ],
                // ...
            ],
        ],
    ],
];

you can also combine your log targets:

'log' => [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class' => yii\log\FileTarget::class,
            'levels' => ['error', 'warning'],
        ],
        [
            'class' => wepushit\log\SplunkTarget::class,
            'levels' => ['error', 'warning']
        ],
    ],
],

additionally you should adjust your params-config:

return [
    // ...
    'splunk' => [
        'host' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'example server',
        'token' => 'token from your Splunk HTTP Event Collector',
        'url' => 'https://example.com:8088/services/collector/event',
        'source' => 'example',
        'sourcetype' => 'yii-errorhandler',
    ],
];

Standard usage:

Yii::info('Info message');
Yii::error('Error message');
Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2