Improve some parts of the documentation.

This commit is contained in:
Ludovic Fernandez 2019-06-21 10:54:04 +02:00 committed by Traefiker Bot
parent a918dcd5a4
commit 69a1817c3f
3 changed files with 68 additions and 43 deletions

View file

@ -5,41 +5,57 @@ Reading What's Happening
By default, logs are written to stdout, in text format.
## Configuration Example
??? example "Writing Logs in a File"
```toml
[log]
filePath = "/path/to/traefik.log"
```
??? example "Writing Logs in a File, in JSON"
```toml
[log]
filePath = "/path/to/log-file.log"
format = "json"
```
## Configuration Options
## Configuration
### General
Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on).
#### filePath
#### `filePath`
By default, the logs are written to the standard output.
You can configure a file path instead using the `filePath` option.
#### format
```toml tab="File"
# 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"
```
#### `format`
By default, the logs use a text format (`common`), but you can also ask for the `json` format in the `format` option.
#### log level
```toml tab="File"
# Writing Logs to a File, in JSON
[log]
filePath = "/path/to/log-file.log"
format = "json"
```
By default, the `level` is set to `error`, but you can choose amongst `debug`, `panic`, `fatal`, `error`, `warn`, and `info`.
```bash tab="CLI"
# Writing Logs to a File, in JSON
--log.filePath="/path/to/traefik.log"
--log.format="json"
```
#### `level`
By default, the `level` is set to `ERROR`. Alternative logging levels are `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`.
```toml tab="File"
[log]
level = "DEBUG"
```
```bash tab="CLI"
--log.level="DEBUG"
```
## Log Rotation

View file

@ -44,22 +44,22 @@ You can define them using a toml file, CLI arguments, or a key-value store.
See the complete reference for the list of available options:
```toml tab="File"
[EntryPoints]
[entryPoints]
[EntryPoints.EntryPoint0]
[entryPoints.EntryPoint0]
Address = ":8888"
[EntryPoints.EntryPoint0.Transport]
[EntryPoints.EntryPoint0.Transport.LifeCycle]
[entryPoints.EntryPoint0.Transport]
[entryPoints.EntryPoint0.Transport.LifeCycle]
RequestAcceptGraceTimeout = 42
GraceTimeOut = 42
[EntryPoints.EntryPoint0.Transport.RespondingTimeouts]
[entryPoints.EntryPoint0.Transport.RespondingTimeouts]
ReadTimeout = 42
WriteTimeout = 42
IdleTimeout = 42
[EntryPoints.EntryPoint0.ProxyProtocol]
[entryPoints.EntryPoint0.ProxyProtocol]
Insecure = true
TrustedIPs = ["foobar", "foobar"]
[EntryPoints.EntryPoint0.ForwardedHeaders]
[entryPoints.EntryPoint0.ForwardedHeaders]
Insecure = true
TrustedIPs = ["foobar", "foobar"]
```

View file

@ -37,7 +37,9 @@ In the process, routers may use pieces of [middleware](../../middlewares/overvie
address = ":80"
[entryPoints.mysql-default]
address = ":3306"
```
```toml
[tcp]
[tcp.routers]
[tcp.routers.to-database]
@ -51,7 +53,7 @@ In the process, routers may use pieces of [middleware](../../middlewares/overvie
### EntryPoints
If not specified, HTTP routers will accept requests from all defined entry points.
If you want to limit the router scope to a set of entrypoints, set the entrypoints option.
If you want to limit the router scope to a set of entry points, set the `entryPoints` option.
??? example "Listens to Every EntryPoint"
@ -63,7 +65,9 @@ If you want to limit the router scope to a set of entrypoints, set the entrypoin
# ...
[entryPoints.other]
# ...
```
```toml
[http.routers]
[http.routers.Router-1]
# By default, routers listen to every entrypoints
@ -81,7 +85,9 @@ If you want to limit the router scope to a set of entrypoints, set the entrypoin
# ...
[entryPoints.other]
# ...
```
```toml
[http.routers]
[http.routers.Router-1]
entryPoints = ["web-secure", "other"] # won't listen to entrypoint web
@ -105,6 +111,7 @@ If the rule is verified, the router becomes active, calls middlewares, and then
```toml
rule = "Host(`traefik.io`) || (Host(`containo.us`) && Path(`/traefik`))"
```
The table below lists all the available matchers:
| Rule | Description |
@ -126,7 +133,7 @@ The table below lists all the available matchers:
!!! tip "Combining Matchers Using Operators and Parenthesis"
You can combine multiple matchers using the AND (`&&`) and OR (`||) operators. You can also use parenthesis.
You can combine multiple matchers using the AND (`&&`) and OR (`||`) operators. You can also use parenthesis.
!!! important "Rule, Middleware, and Services"
@ -212,7 +219,6 @@ It refers to a [tlsOptions](../../https/tls.md#tls-options) and will be applied
[http.routers.Router-1.tls] # will terminate the TLS request
options = "foo"
[tlsOptions]
[tlsOptions.foo]
minVersion = "VersionTLS12"
@ -244,7 +250,9 @@ If you want to limit the router scope to a set of entry points, set the entry po
# ...
[entryPoints.other]
# ...
```
```toml
[tcp.routers]
[tcp.routers.Router-1]
# By default, routers listen to every entrypoints
@ -263,7 +271,9 @@ If you want to limit the router scope to a set of entry points, set the entry po
# ...
[entryPoints.other]
# ...
```
```toml
[tcp.routers]
[tcp.routers.Router-1]
entryPoints = ["web-secure", "other"] # won't listen to entrypoint web
@ -340,7 +350,6 @@ It refers to a [tlsOptions](../../https/tls.md#tls-options) and will be applied
[tcp.routers.Router-1.tls] # will terminate the TLS request
options = "foo"
[tlsOptions]
[tlsOptions.foo]
minVersion = "VersionTLS12"