You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is a plugin for the docker engine, which delivers logs to Sumo Logic by pushing log messages through an HTTP source.
3
+
This is the guide for developers who want build and extend the plugin. If you just want use this plugin in your docker environment, please refer to the [readme file](README.md).
4
+
5
+
## Prerequisite
6
+
*[Download](https://www.docker.com/get-docker) and install latest docker engine
7
+
*[Download](https://golang.org/dl/) and install latest Go language distribution
8
+
* Clone/Download this repository to a local directory, and
9
+
* Get all dependencies with
10
+
```bash
11
+
$ go get -d ./...
12
+
```
13
+
14
+
## Build and install plugin to docker
15
+
In bash, run:
16
+
```bash
17
+
$ sudo bash ./plugin_install.sh
18
+
```
19
+
If everything goes fine, you can verify that the plugin is correctly installed with:
$ docker run --log-driver=sumologic --log-opt sumo-url=<url> -i -t ubuntu bash
37
+
```
38
+
This will create a bash session in a docker container and send all console contents to a Sumo Logic HTTP source as log lines
39
+
40
+
## Run unit test
41
+
The unit test is written in `XXX_test.go` which `XXX` is the module to be tested. You can launch all unit tests with:
42
+
```bash
43
+
$ go test -v
44
+
```
45
+
The unit test do not require docker environment to run. For details about unit test or test framework in Go language, click [here](https://golang.org/pkg/testing/).
Create a [Sumo Logic account](https://www.sumologic.com/) if you don't currently have one.
27
25
28
26
Follow these instructions for [setting up an HTTP Source](https://help.sumologic.com/Send-Data/Sources/02Sources-for-Hosted-Collectors/HTTP-Source/zGenerate-a-new-URL-for-an-HTTP-Source) in Sumo Logic. Be sure to obtain the URL endpoint after creating an HTTP Source.
@@ -37,18 +35,24 @@ $ docker run --log-driver=sumologic --log-opt sumo-url=https://<deployment>.sumo
37
35
### Sumo Logic Options
38
36
To specify additional logging driver options, you can use the `--log-opt NAME=VALUE` flag.
39
37
40
-
| Option | Required? | Default Value | Description
| sumo-compress-level | No | -1 | Set the gzip compression level. Valid values are -1 (default), 0 (no compression), 1 (best speed) ... 9 (best compression).
45
-
| sumo-batch-size | No | 1000000 | The number of bytes of logs the driver should wait for before sending them in bulk. If the number of bytes never reaches `sumo-batch-size`, the driver will send the logs in smaller batches at predefined intervals; see `sumo-sending-interval`.
46
-
| sumo-sending-interval | No | 2s | The maximum time the driver waits for number of logs to reach `sumo-batch-size` before sending the logs, even if the number of logs is less than the batch size. In the format 72h3m5s, valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
47
-
| sumo-proxy-url | No | | Set a proxy URL.
48
-
| sumo-insecure-skip-verify | No | false | Ignore server certificate validation. Boolean.
49
-
| sumo-root-ca-path | No | | Set the path to a custom root certificate.
50
-
| sumo-server-name | No | | Name used to validate the server certificate. By default, uses hostname of the `sumo-url`.
51
-
| sumo-queue-size | No | 100 | The maximum number of log batches of size `sumo-batch-size` we can store in memory in the event of network failure, before we begin dropping batches. Thus in the worst case, the plugin will use `sumo-batch-size` * `sumo-queue-size` bytes of memory per container (default 100 MB).
38
+
| Option | Required? | Default Value | Description
| sumo-source-category | No | HTTP source category | Source category to appear when searching in Sumo Logic by `_sourceCategory`. Within the source category, the token `{{Tag}}` will be replaced with the value of the Docker tag option. If not specified, the default source category configured for the HTTP source will be used.
42
+
| sumo-source-name | No | container's name | Source name to appear when searching in Sumo Logic by `_sourceName`. Within the source name, the token `{{Tag}}` will be replaced with the value of the Docker tag option. If not specified, the container's name will be used.
43
+
| sumo-source-host | No | host name | Source host to appear when searching in Sumo Logic by `_sourceHost`. Within the source host, the token `{{Tag}}` will be replaced with the value of the Docker tag option. If not specified, the machine host name will be used.
| sumo-compress-level | No | `-1` | Set the gzip compression level. Valid values are -1 (default), 0 (no compression), 1 (best speed) ... 9 (best compression).
46
+
| sumo-batch-size | No | `1000000` | The number of bytes of logs the driver should wait for before sending them in bulk. If the number of bytes never reaches `sumo-batch-size`, the driver will send the logs in smaller batches at predefined intervals; see `sumo-sending-interval`.
47
+
| sumo-sending-interval | No | `2s` | The maximum time the driver waits for number of logs to reach `sumo-batch-size` before sending the logs, even if the number of logs is less than the batch size. In the format 72h3m5s, valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
48
+
| sumo-proxy-url | No | | Set a proxy URL.
49
+
| sumo-insecure-skip-verify | No | `false` | Ignore server certificate validation. Boolean.
50
+
| sumo-root-ca-path | No | | Set the path to a custom root certificate.
51
+
| sumo-server-name | No | | Name used to validate the server certificate. By default, uses hostname of the `sumo-url`.
52
+
| sumo-queue-size | No | `100` | The maximum number of log batches of size `sumo-batch-size` we can store in memory in the event of network failure, before we begin dropping batches. Thus in the worst case, the plugin will use `sumo-batch-size` * `sumo-queue-size` bytes of memory per container (default 100 MB).
53
+
| tag | No | `{{.ID}}` | Specifies a tag for messages, which can be used in the "source category", "source name", and "source host" fields. Certain tokens of the form {{X}} are supported. Default value is `{{.ID}}`, the first 12 characters of the container ID. Refer to the [tag log-opt documentation] for more information and a list of supported tokens.
0 commit comments