coredns/plugin/errors
Yong Tang f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* Update Caddy to 1.0.1, and update import path

This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy

This fix fixes 2959

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Also update plugin.cfg

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update and bump zplugin.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-03 09:04:47 +08:00
..
benchmark_test.go Add benchmark test (#2610) 2019-02-25 06:57:27 -08:00
errors.go plugin/errors: remove cLogger and eLogger (#2657) 2019-03-07 20:14:09 +00:00
errors_test.go plugin/errors: remove cLogger and eLogger (#2657) 2019-03-07 20:14:09 +00:00
log_test.go Clean up tests logging (#1979) 2018-07-19 16:23:06 +01:00
OWNERS Add OWNERS file (#1486) 2018-02-08 10:55:51 +00:00
README.md recommended (#2283) 2018-11-09 20:32:43 +00:00
setup.go Update Caddy to 1.0.1, and update import path (#2961) 2019-07-03 09:04:47 +08:00
setup_test.go Update Caddy to 1.0.1, and update import path (#2961) 2019-07-03 09:04:47 +08:00

errors

Name

errors - enable error logging.

Description

Any errors encountered during the query processing will be printed to standard output. The errors of particular type can be consolidated and printed once per some period of time.

This plugin can only be used once per Server Block.

Syntax

The basic syntax is:

errors

Extra knobs are available with an expanded syntax:

errors {
	consolidate DURATION REGEXP
}

Option consolidate allows collecting several error messages matching the regular expression REGEXP during DURATION. After the DURATION since receiving the first such message, the consolidated message will be printed to standard output, e.g.

2 errors like '^read udp .* i/o timeout$' occurred in last 30s

Multiple consolidate options with different DURATION and REGEXP are allowed. In case if some error message corresponds to several defined regular expressions the message will be associated with the first appropriate REGEXP.

For better performance, it's recommended to use the ^ or $ metacharacters in regular expression when filtering error messages by prefix or suffix, e.g. ^failed to .*, or .* timeout$.

Examples

Use the whoami to respond to queries and Log errors to standard output.

. {
    whoami
    errors
}

Use the forward to resolve queries via 8.8.8.8 and print consolidated error messages for errors with suffix " i/o timeout" or with prefix "Failed to ".

. {
    forward . 8.8.8.8
    errors {
        consolidate 5m ".* i/o timeout$"
        consolidate 30s "^Failed to .+"
    }
}