-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
b88e2b6
commit 309c1fe
Showing
3 changed files
with
225 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters