-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logging: add support for additional logger filters other than hostname
- Loading branch information
1 parent
a747930
commit 9643509
Showing
5 changed files
with
151 additions
and
12 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
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
129 changes: 129 additions & 0 deletions
129
caddytest/integration/caddyfile_adapt/log_filter_with_header.txt
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,129 @@ | ||
localhost { | ||
log { | ||
output file ./caddy.access.log | ||
} | ||
log health_check_log { | ||
output file ./caddy.access.health.log | ||
no_host_name | ||
} | ||
@healthCheck `header_regexp('User-Agent', '^some-regexp$') || path('/healthz*')` | ||
handle @healthCheck { | ||
vars access_logger_name health_check_log | ||
respond "Healthy" | ||
} | ||
|
||
handle { | ||
respond "Hello World" | ||
} | ||
} | ||
---------- | ||
{ | ||
"logging": { | ||
"logs": { | ||
"default": { | ||
"exclude": [ | ||
"http.log.access.health_check_log", | ||
"http.log.access.log0" | ||
] | ||
}, | ||
"health_check_log": { | ||
"writer": { | ||
"filename": "./caddy.access.health.log", | ||
"output": "file" | ||
}, | ||
"include": [ | ||
"http.log.access.health_check_log" | ||
] | ||
}, | ||
"log0": { | ||
"writer": { | ||
"filename": "./caddy.access.log", | ||
"output": "file" | ||
}, | ||
"include": [ | ||
"http.log.access.log0" | ||
] | ||
} | ||
} | ||
}, | ||
"apps": { | ||
"http": { | ||
"servers": { | ||
"srv0": { | ||
"listen": [ | ||
":443" | ||
], | ||
"routes": [ | ||
{ | ||
"match": [ | ||
{ | ||
"host": [ | ||
"localhost" | ||
] | ||
} | ||
], | ||
"handle": [ | ||
{ | ||
"handler": "subroute", | ||
"routes": [ | ||
{ | ||
"group": "group2", | ||
"handle": [ | ||
{ | ||
"handler": "subroute", | ||
"routes": [ | ||
{ | ||
"handle": [ | ||
{ | ||
"access_logger_name": "health_check_log", | ||
"handler": "vars" | ||
}, | ||
{ | ||
"body": "Healthy", | ||
"handler": "static_response" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"match": [ | ||
{ | ||
"expression": "header_regexp('User-Agent', '^some-regexp$') || path('/healthz*')" | ||
} | ||
] | ||
}, | ||
{ | ||
"group": "group2", | ||
"handle": [ | ||
{ | ||
"handler": "subroute", | ||
"routes": [ | ||
{ | ||
"handle": [ | ||
{ | ||
"body": "Hello World", | ||
"handler": "static_response" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"terminal": true | ||
} | ||
], | ||
"logs": { | ||
"logger_names": { | ||
"localhost": "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