github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/docs/reference/logging/splunk.md (about) 1 <!--[metadata]> 2 +++ 3 title = "Splunk logging driver" 4 description = "Describes how to use the Splunk logging driver." 5 keywords = ["splunk, docker, logging, driver"] 6 [menu.main] 7 parent = "smn_logging" 8 weight = 2 9 +++ 10 <![end-metadata]--> 11 12 # Splunk logging driver 13 14 The `splunk` logging driver sends container logs to 15 [HTTP Event Collector](http://dev.splunk.com/view/event-collector/SP-CAAAE6M) 16 in Splunk Enterprise and Splunk Cloud. 17 18 ## Usage 19 20 You can configure the default logging driver by passing the `--log-driver` 21 option to the Docker daemon: 22 23 docker daemon --log-driver=splunk 24 25 You can set the logging driver for a specific container by using the 26 `--log-driver` option to `docker run`: 27 28 docker run --log-driver=splunk ... 29 30 ## Splunk options 31 32 You can use the `--log-opt NAME=VALUE` flag to specify these additional Splunk 33 logging driver options: 34 35 | Option | Required | Description | 36 |-----------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 37 | `splunk-token` | required | Splunk HTTP Event Collector token. | 38 | `splunk-url` | required | Path to your Splunk Enterprise or Splunk Cloud instance (including port and schema used by HTTP Event Collector) `https://your_splunk_instance:8088`. | 39 | `splunk-source` | optional | Event source. | 40 | `splunk-sourcetype` | optional | Event source type. | 41 | `splunk-index` | optional | Event index. | 42 | `splunk-capath` | optional | Path to root certificate. | 43 | `splunk-caname` | optional | Name to use for validating server certificate; by default the hostname of the `splunk-url` will be used. | 44 | `splunk-insecureskipverify` | optional | Ignore server certificate validation. | 45 | `tag` | optional | Specify tag for message, which interpret some markup. Default value is `{{.ID}}` (12 characters of the container ID). Refer to the [log tag option documentation](log_tags.md) for customizing the log tag format. | 46 | `labels` | optional | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container. | 47 | `env` | optional | Comma-separated list of keys of environment variables, which should be included in message, if these variables are specified for container. | 48 49 If there is collision between `label` and `env` keys, the value of the `env` takes precedence. 50 Both options add additional fields to the attributes of a logging message. 51 52 Below is an example of the logging option specified for the Splunk Enterprise 53 instance. The instance is installed locally on the same machine on which the 54 Docker daemon is running. The path to the root certificate and Common Name is 55 specified using an HTTPS schema. This is used for verification. 56 The `SplunkServerDefaultCert` is automatically generated by Splunk certificates. 57 58 docker run --log-driver=splunk \ 59 --log-opt splunk-token=176FCEBF-4CF5-4EDF-91BC-703796522D20 \ 60 --log-opt splunk-url=https://splunkhost:8088 \ 61 --log-opt splunk-capath=/path/to/cert/cacert.pem \ 62 --log-opt splunk-caname=SplunkServerDefaultCert 63 --log-opt tag="{{.Name}}/{{.FullID}}" 64 --log-opt labels=location 65 --log-opt env=TEST 66 --env "TEST=false" 67 --label location=west 68 your/application