From 408b9411f457ad78ef6de23a65a22cf2a7c2a800 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Fri, 25 Oct 2019 00:02:32 -0600 Subject: [PATCH] Fill out more log docs --- v2:-Documentation.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/v2:-Documentation.md b/v2:-Documentation.md index 080b435..e4ce931 100644 --- a/v2:-Documentation.md +++ b/v2:-Documentation.md @@ -872,8 +872,8 @@ Configures Caddy logs. "first": 100, "thereafter": 100 }, - "allow_modules": [], - "deny_modules": [] + "include": [], + "exclude": [] } } } @@ -890,10 +890,10 @@ Configures Caddy logs. - `logs.default.sampling.interval`: The window over which to conduct sampling. - `logs.default.sampling.first`: Log this many entries within a given level and message for each interval. - `logs.default.sampling.thereafter`: If more entries with the same level and message are seen during the same interval, keep one in this many entries until the end of the interval. -- `logs.default.allow_modules`: Allow modules within this namespace to emit logs here. Mutually exclusive with `deny_modules`. -- `logs.default.deny_modules`: Deny modules within this namespace from emitting logs here. Mutually exclusive with `allow_modules`. +- `logs.default.include`: Allow modules within this namespace to emit logs here. Mutually exclusive with `exclude`. +- `logs.default.exlucde`: Deny modules within this namespace from emitting logs here. Mutually exclusive with `include`. -If both `allow_modules` and `deny_modules` are populated, longer namespaces have priority. If neither are populated, all logs are emitted. +If both `include` and `exclude` are populated, longer namespaces have priority. If neither are populated, all logs are emitted. ### caddy.logging.writers @@ -949,6 +949,32 @@ Writes logs to a local file, optionally with automatic log rolling. Log rolling Encoders determine how log entries are encoded (formatted). +In addition to the properties specific to each encoder, these properties are available for all encoders (and have the following defaults): + +```json +{ + "message_key": "msg", + "level_key": "level", + "time_key": "ts", + "name_key": "logger", + "caller_key": "caller", + "stacktrace_key": "stacktrace", + "line_ending": "\n", + "time_format": "unix_seconds_float", + "duration_format": "seconds" +} +``` + +- `message_key`: The key for the message field. +- `level_key`: The key for the level field. +- `time_key`: The key for the timestamp field. +- `name_key`: The key for the name of the logger field. +- `caller_key`: The key for the caller field. +- `stacktrace_key`: The key for the stacktrace field. +- `line_ending`: The line ending to use. +- `time_format`: The format to use for timestamps. Can be: "unix_seconds_float", "unix_milli_float", "unix_nano", "iso8601", "rfc3339", "rfc3339_nano", "wall", "wall_milli", "wall_nano", or [any time format value accepted by Go's time package](https://golang.org/pkg/time/#pkg-constants). +- `duration_format`: The format to use for duration values. Can be "seconds", "nano", or "string". + #### caddy.logging.encoders.console Formats log enties for human readability on the console. @@ -1022,7 +1048,7 @@ Formats each structured log entry as [logfmt](https://www.brandur.org/logfmt). N #### caddy.logging.encoders.string -An encoder that will write an entry that consists exclusively of a single field in the log. This is useful if a particular field in the log entry is already formatted the way you want. +An encoder that will write an entry that consists exclusively of a single field in the log. This is useful if that particular field is already formatted the way you want your logs formatted. ```json {