File tree Expand file tree Collapse file tree 1 file changed +60
-1
lines changed Expand file tree Collapse file tree 1 file changed +60
-1
lines changed Original file line number Diff line number Diff line change 1
- # yii2-splunk-log-target
1
+ # yii2-splunk-log-target
2
+
3
+ Allows you to to send logs to your Splunk Enterprise.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ composer require "we-push-it/yii2-splunk-log-target"
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ In order to use ` SplunkTarget ` you should configure your ` log ` application component like the following:
14
+
15
+ ``` php
16
+ return [
17
+ // ...
18
+ 'bootstrap' => ['log'],
19
+ // ...
20
+ 'components' => [
21
+ // ...
22
+ 'log' => [
23
+ 'targets' => [
24
+ [
25
+ 'class' => 'wepushit\log\SplunkTarget',
26
+
27
+ // It is optional parameter. The message levels that this target is interested in.
28
+ // The parameter can be an array.
29
+ 'levels' => ['error', 'warning'],
30
+ ],
31
+ // ...
32
+ ],
33
+ ],
34
+ ],
35
+ ];
36
+ ```
37
+
38
+ additionally you should adjust your params-config:
39
+
40
+ ``` php
41
+ return [
42
+ // ...
43
+ 'splunk' => [
44
+ 'host' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'example server',
45
+ 'token' => 'token from your Splunk HTTP Event Collector',
46
+ 'url' => 'https://example.com:8088/services/collector/event',
47
+ 'source' => 'example',
48
+ 'sourcetype' => 'yii-errorhandler',
49
+ ],
50
+ ];
51
+ ```
52
+
53
+
54
+ Standard usage:
55
+
56
+ ``` php
57
+ Yii::info('Info message');
58
+ Yii::error('Error message');
59
+ ```
60
+
You can’t perform that action at this time.
0 commit comments