Skip to content

Commit d16690d

Browse files
author
Dominik Haßelkuss
committed
modifed Readme
1 parent e70babf commit d16690d

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
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+

0 commit comments

Comments
 (0)