From 69a1817c3f8e5afebf43ab3ba4eefdf4e17fb47b Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 21 Jun 2019 10:54:04 +0200 Subject: [PATCH] Improve some parts of the documentation. --- docs/content/observability/logs.md | 60 +++++++++++++++++---------- docs/content/routing/entrypoints.md | 14 +++---- docs/content/routing/routers/index.md | 37 ++++++++++------- 3 files changed, 68 insertions(+), 43 deletions(-) diff --git a/docs/content/observability/logs.md b/docs/content/observability/logs.md index ba8eda6c2..6d8027676 100644 --- a/docs/content/observability/logs.md +++ b/docs/content/observability/logs.md @@ -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 diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index 2734bf54c..976ca244c 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -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"] ``` diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 0dfaa2348..ac8990d32 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -36,8 +36,10 @@ In the process, routers may use pieces of [middleware](../../middlewares/overvie [entryPoints.mysql-default] address = ":80" [entryPoints.mysql-default] - address = ":3306" - + address = ":3306" + ``` + + ```toml [tcp] [tcp.routers] [tcp.routers.to-database] @@ -50,8 +52,8 @@ In the process, routers may use pieces of [middleware](../../middlewares/overvie ### EntryPoints -If not specified, HTTP routers will accept requests from all defined entrypoints. -If you want to limit the router scope to a set of entrypoints, set the entrypoints option. +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 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 @@ -97,14 +103,15 @@ If the rule is verified, the router becomes active, calls middlewares, and then ??? example "Host is traefik.io" ```toml - rule = "Host(`traefik.io`)" + rule = "Host(`traefik.io`)" ``` ??? example "Host is traefik.io OR Host is containo.us AND path is /traefik" ```toml - rule = "Host(`traefik.io`) || (Host(`containo.us`) && Path(`/traefik`))" + 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" @@ -234,7 +240,7 @@ If no matching route is found for the TCP routers, then the HTTP routers will ta If not specified, TCP routers will accept requests from all defined entry points. If you want to limit the router scope to a set of entry points, set the entry points option. -??? example "Listens to Every EntryPoint" +??? example "Listens to Every Entry Point" ```toml [entryPoints] @@ -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 @@ -253,7 +261,7 @@ If you want to limit the router scope to a set of entry points, set the entry po [tcp.routers.Router-1.tls] # will route TLS requests (and ignore non tls requests) ``` -??? example "Listens to Specific EntryPoints" +??? example "Listens to Specific Entry Points" ```toml [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"