1
0
Fork 0

doc: improve examples.

This commit is contained in:
Ludovic Fernandez 2019-07-22 09:58:04 +02:00 committed by Traefiker Bot
parent 8b4ba3cb67
commit 75c99a0491
69 changed files with 1256 additions and 552 deletions

View file

@ -9,12 +9,16 @@ By default, logs are written to stdout, in text format.
To enable the access logs:
```toml tab="File"
```toml tab="File (TOML)"
[accessLog]
```
```yaml tab="File (YAML)"
accessLog: {}
```
```bash tab="CLI"
--accesslog
--accesslog=true
```
### `filePath`
@ -41,16 +45,23 @@ To write the logs in an asynchronous fashion, specify a `bufferingSize` option.
This option represents the number of log lines Traefik will keep in memory before writing them to the selected output.
In some cases, this option can greatly help performances.
```toml tab="File"
```toml tab="File (TOML)"
# Configuring a buffer of 100 lines
[accessLog]
filePath = "/path/to/access.log"
bufferingSize = 100
```
```yaml tab="File (YAML)"
# Configuring a buffer of 100 lines
accessLog:
filePath: "/path/to/access.log"
bufferingSize: 100
```
```bash tab="CLI"
# Configuring a buffer of 100 lines
--accesslog
--accesslog=true
--accesslog.filepath="/path/to/access.log"
--accesslog.bufferingsize=100
```
@ -66,11 +77,11 @@ The available filters are:
- `retryAttempts`, to keep the access logs when at least one retry has happened
- `minDuration`, to keep access logs when requests take longer than the specified duration
```toml tab="File"
```toml tab="File (TOML)"
# Configuring Multiple Filters
[accessLog]
filePath = "/path/to/access.log"
format = "json"
filePath = "/path/to/access.log"
format = "json"
[accessLog.filters]
statusCodes = ["200", "300-302"]
@ -78,9 +89,22 @@ format = "json"
minDuration = "10ms"
```
```yaml tab="File (YAML)"
# Configuring Multiple Filters
accessLog:
filePath: "/path/to/access.log"
format: json
filters:
statusCodes:
- "200"
- "300-302"
retryAttempts: true
minDuration: "10ms"
```
```bash tab="CLI"
# Configuring Multiple Filters
--accesslog
--accesslog=true
--accesslog.filepath="/path/to/access.log"
--accesslog.format="json"
--accesslog.filters.statuscodes="200, 300-302"
@ -100,7 +124,7 @@ Each field can be set to:
The `defaultMode` for `fields.header` is `drop`.
```toml tab="File"
```toml tab="File (TOML)"
# Limiting the Logs to Specific Fields
[accessLog]
filePath = "/path/to/access.log"
@ -121,9 +145,27 @@ The `defaultMode` for `fields.header` is `drop`.
"Content-Type" = "keep"
```
```yaml tab="File (YAML)"
# Limiting the Logs to Specific Fields
accessLog:
filePath: "/path/to/access.log"
format: json
fields:
defaultMode: keep
fields:
names:
ClientUsername: drop
headers:
defaultMode: keep
names:
- User-Agent: redact
- Authorization: drop
- Content-Type: keep
```
```bash tab="CLI"
# Limiting the Logs to Specific Fields
--accesslog
--accesslog=true
--accesslog.filepath="/path/to/access.log"
--accesslog.format="json"
--accesslog.fields.defaultmode="keep"

View file

@ -16,12 +16,18 @@ Traefik logs concern everything that happens to Traefik itself (startup, configu
By default, the logs are written to the standard output.
You can configure a file path instead using the `filePath` option.
```toml tab="File"
```toml tab="File (TOML)"
# Writing Logs to a File
[log]
filePath = "/path/to/traefik.log"
```
```yaml tab="File (YAML)"
# Writing Logs to a File
log:
filePath: "/path/to/traefik.log"
```
```bash tab="CLI"
# Writing Logs to a File
--log.filePath="/path/to/traefik.log"
@ -31,11 +37,18 @@ You can configure a file path instead using the `filePath` option.
By default, the logs use a text format (`common`), but you can also ask for the `json` format in the `format` option.
```toml tab="File"
```toml tab="File (TOML)"
# Writing Logs to a File, in JSON
[log]
filePath = "/path/to/log-file.log"
format = "json"
format = "json"
```
```yaml tab="File (YAML)"
# Writing Logs to a File, in JSON
log:
filePath: "/path/to/log-file.log"
format: json
```
```bash tab="CLI"
@ -48,11 +61,16 @@ By default, the logs use a text format (`common`), but you can also ask for the
By default, the `level` is set to `ERROR`. Alternative logging levels are `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`.
```toml tab="File"
```toml tab="File (TOML)"
[log]
level = "DEBUG"
```
```yaml tab="File (YAML)"
log:
level: DEBUG
```
```bash tab="CLI"
--log.level="DEBUG"
```

View file

@ -7,9 +7,13 @@ To enable the DataDog:
[metrics.dataDog]
```
```yaml tab="File (YAML)"
metrics:
dataDog: {}
```
```bash tab="CLI"
--metrics
--metrics.datadog
--metrics.datadog=true
```
#### `address`
@ -24,14 +28,13 @@ Address instructs exporter to send metrics to datadog-agent at this address.
address = "127.0.0.1:8125"
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
dataDog:
address: 127.0.0.1:8125
```
```bash tab="CLI"
--metrics
--metrics.datadog.address="127.0.0.1:8125"
```
@ -47,14 +50,13 @@ Enable metrics on entry points.
addEntryPointsLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
dataDog:
addEntryPointsLabels: true
```
```bash tab="CLI"
--metrics
--metrics.datadog.addEntryPointsLabels=true
```
@ -70,14 +72,13 @@ Enable metrics on services.
addServicesLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
dataDog:
addServicesLabels: true
```
```bash tab="CLI"
--metrics
--metrics.datadog.addServicesLabels=true
```
@ -93,14 +94,13 @@ The interval used by the exporter to push metrics to datadog-agent.
pushInterval = 10s
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
dataDog:
pushInterval: 10s
```
```bash tab="CLI"
--metrics
--metrics.datadog.pushInterval=10s
```

View file

@ -7,14 +7,13 @@ To enable the InfluxDB:
[metrics.influxdb]
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb: {}
```
```bash tab="CLI"
--metrics
--metrics.influxdb
--metrics.influxdb=true
```
#### `address`
@ -29,14 +28,13 @@ Address instructs exporter to send metrics to influxdb at this address.
address = "localhost:8089"
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
address: localhost:8089
```
```bash tab="CLI"
--metrics
--metrics.influxdb.address="localhost:8089"
```
@ -52,14 +50,13 @@ InfluxDB's address protocol (udp or http).
protocol = "upd"
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
protocol: udp
```
```bash tab="CLI"
--metrics
--metrics.influxdb.protocol="udp"
```
@ -75,14 +72,13 @@ InfluxDB database used when protocol is http.
database = ""
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
database: ""
```
```bash tab="CLI"
--metrics
--metrics.influxdb.database=""
```
@ -98,14 +94,13 @@ InfluxDB retention policy used when protocol is http.
retentionPolicy = ""
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
retentionPolicy: ""
```
```bash tab="CLI"
--metrics
--metrics.influxdb.retentionPolicy=""
```
@ -121,14 +116,13 @@ InfluxDB username (only with http).
username = ""
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
username: ""
```
```bash tab="CLI"
--metrics
--metrics.influxdb.username=""
```
@ -144,14 +138,13 @@ InfluxDB password (only with http).
password = ""
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
password: ""
```
```bash tab="CLI"
--metrics
--metrics.influxdb.password=""
```
@ -167,14 +160,13 @@ Enable metrics on entry points.
addEntryPointsLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
addEntryPointsLabels: true
```
```bash tab="CLI"
--metrics
--metrics.influxdb.addEntryPointsLabels=true
```
@ -190,14 +182,13 @@ Enable metrics on services.
addServicesLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
addServicesLabels: true
```
```bash tab="CLI"
--metrics
--metrics.influxdb.addServicesLabels=true
```
@ -213,13 +204,12 @@ The interval used by the exporter to push metrics to influxdb.
pushInterval = 10s
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
influxdb:
pushInterval: 10s
```
```bash tab="CLI"
--metrics
--metrics.influxdb.pushInterval=10s
```

View file

@ -17,10 +17,10 @@ To enable metrics:
[metrics]
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics: {}
```
```bash tab="CLI"
--metrics
--metrics=true
```

View file

@ -7,14 +7,13 @@ To enable the Prometheus:
[metrics.prometheus]
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
prometheus: {}
```
```bash tab="CLI"
--metrics
--metrics.prometheus
--metrics.prometheus=true
```
#### `buckets`
@ -29,7 +28,7 @@ Buckets for latency metrics.
buckets = [0.1,0.3,1.2,5.0]
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
prometheus:
buckets:
@ -40,7 +39,6 @@ metrics:
```
```bash tab="CLI"
--metrics
--metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000
```
@ -56,14 +54,13 @@ Enable metrics on entry points.
addEntryPointsLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
prometheus:
addEntryPointsLabels: true
```
```bash tab="CLI"
--metrics
--metrics.prometheus.addEntryPointsLabels=true
```
@ -79,13 +76,12 @@ Enable metrics on services.
addServicesLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
prometheus:
addServicesLabels: true
```
```bash tab="CLI"
--metrics
--metrics.prometheus.addServicesLabels=true
```

View file

@ -7,14 +7,13 @@ To enable the Statsd:
[metrics.statsd]
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
statsd: {}
```
```bash tab="CLI"
--metrics
--metrics.statsd
--metrics.statsd=true
```
#### `address`
@ -29,14 +28,13 @@ Address instructs exporter to send metrics to statsd at this address.
address = "localhost:8125"
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
statsd:
address: localhost:8125
```
```bash tab="CLI"
--metrics
--metrics.statsd.address="localhost:8125"
```
@ -52,14 +50,13 @@ Enable metrics on entry points.
addEntryPointsLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
statsd:
addEntryPointsLabels: true
```
```bash tab="CLI"
--metrics
--metrics.statsd.addEntryPointsLabels=true
```
@ -75,14 +72,13 @@ Enable metrics on services.
addServicesLabels = true
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
statsd:
addServicesLabels: true
```
```bash tab="CLI"
--metrics
--metrics.statsd.addServicesLabels=true
```
@ -98,13 +94,12 @@ The interval used by the exporter to push metrics to statsD.
pushInterval = 10s
```
```yaml tab="File (TOML)"
```yaml tab="File (YAML)"
metrics:
statsd:
pushInterval: 10s
```
```bash tab="CLI"
--metrics
--metrics.statsd.pushInterval=10s
```

View file

@ -13,8 +13,7 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.datadog
--tracing.datadog=true
```
#### `localAgentHostPort`
@ -36,7 +35,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.datadog.localAgentHostPort="127.0.0.1:8126"
```
@ -59,7 +57,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.datadog.debug=true
```
@ -82,7 +79,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.datadog.globalTag="sample"
```
@ -106,6 +102,5 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.datadog.prioritySampling=true
```

View file

@ -13,8 +13,7 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack
--tracing.haystack=true
```
#### `localAgentHost`
@ -36,7 +35,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.localAgentHost="127.0.0.1"
```
@ -59,7 +57,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.localAgentPort=42699
```
@ -82,7 +79,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.globalTag="sample:test"
```
@ -105,7 +101,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.traceIDHeaderName="sample"
```
@ -128,7 +123,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.parentIDHeaderName="sample"
```
@ -151,7 +145,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.haystack.spanIDHeaderName=sample:test
```
@ -175,6 +168,5 @@ tracing:
```bash tab="CLI"
--tracing
--tracing.haystack.baggagePrefixHeaderName="sample"
```

View file

@ -13,8 +13,7 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.instana
--tracing.instana=true
```
#### `localAgentHost`
@ -36,7 +35,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.instana.localAgentHost="127.0.0.1"
```
@ -59,7 +57,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.instana.localAgentPort=42699
```
@ -89,6 +86,5 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.instana.logLevel="info"
```

View file

@ -13,8 +13,7 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger
--tracing.jaeger=true
```
!!! warning
@ -40,7 +39,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.samplingServerURL="http://localhost:5778/sampling"
```
@ -63,7 +61,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.samplingType="const"
```
@ -92,7 +89,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.samplingParam="1.0"
```
@ -115,7 +111,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.localAgentHostPort="127.0.0.1:6831"
```
@ -138,7 +133,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.gen128Bit
```
@ -165,7 +159,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.propagation="jaeger"
```
@ -189,7 +182,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.traceContextHeaderName="uber-trace-id"
```
@ -214,7 +206,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.collector.endpoint="http://127.0.0.1:14268/api/traces?format=jaeger.thrift"
```
@ -238,7 +229,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.collector.user="my-user"
```
@ -262,6 +252,5 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.jaeger.collector.password="my-password"
```

View file

@ -30,7 +30,7 @@ tracing: {}
```
```bash tab="CLI"
--tracing
--tracing=true
```
### Common Options
@ -52,7 +52,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.serviceName="traefik"
```
@ -76,6 +75,5 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.spanNameLimit=150
```

View file

@ -13,8 +13,7 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin
--tracing.zipkin=true
```
#### `httpEndpoint`
@ -36,7 +35,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin.httpEndpoint="http://localhost:9411/api/v1/spans"
```
@ -59,7 +57,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin.debug=true
```
@ -82,7 +79,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin.sameSpan=true
```
@ -105,7 +101,6 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin.id128Bit=false
```
@ -128,6 +123,5 @@ tracing:
```
```bash tab="CLI"
--tracing
--tracing.zipkin.sampleRate="0.2"
```