定制 we-push-it/yii2-splunk-log-target 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Composer 安装命令:

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

包简介

Yii 2 log target which can log to Splunk Enterprise via curl

README 文档

README

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');

统计信息

  • 总下载量: 1.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固