summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2020-09-15 14:37:41 -0400
committerGitHub <noreply@github.com>2020-09-15 12:37:41 -0600
commit309c1fec622c08bdc68a43de64fc0777f590d309 (patch)
tree2ac8254058231e330c63af487f0f9d403bf6200d /caddytest
parentb88e2b6a497789307b0a12f9867cf2ac8088d73a (diff)
logging: Implement Caddyfile support for filter encoder (#3578)
* logging: Implement Caddyfile support for filter encoder * logging: Add support for parsing IP masks from strings wip * logging: Implement Caddyfile support for ip_mask * logging: Get rid of unnecessary logic to allow strings, not that useful * logging: Add adapt test
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/log_filters.txt69
1 files changed, 69 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/log_filters.txt b/caddytest/integration/caddyfile_adapt/log_filters.txt
new file mode 100644
index 0000000..549f4e6
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/log_filters.txt
@@ -0,0 +1,69 @@
+:80
+
+log {
+ output stdout
+ format filter {
+ wrap console
+ fields {
+ request>headers>Authorization delete
+ request>headers>Server delete
+ request>remote_addr ip_mask {
+ ipv4 24
+ ipv6 32
+ }
+ }
+ }
+}
+----------
+{
+ "logging": {
+ "logs": {
+ "default": {
+ "exclude": [
+ "http.log.access.log0"
+ ]
+ },
+ "log0": {
+ "writer": {
+ "output": "stdout"
+ },
+ "encoder": {
+ "fields": {
+ "request\u003eheaders\u003eAuthorization": {
+ "filter": "delete"
+ },
+ "request\u003eheaders\u003eServer": {
+ "filter": "delete"
+ },
+ "request\u003eremote_addr": {
+ "filter": "ip_mask",
+ "ipv4_cidr": 24,
+ "ipv6_cidr": 32
+ }
+ },
+ "format": "filter",
+ "wrap": {
+ "format": "console"
+ }
+ },
+ "include": [
+ "http.log.access.log0"
+ ]
+ }
+ }
+ },
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":80"
+ ],
+ "logs": {
+ "default_logger_name": "log0"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file