Skip to content

Instantly share code, notes, and snippets.

@maartenberg
Created June 3, 2025 11:45
Show Gist options
  • Select an option

  • Save maartenberg/1689897d0be50ea68dc4529089c83df4 to your computer and use it in GitHub Desktop.

Select an option

Save maartenberg/1689897d0be50ea68dc4529089c83df4 to your computer and use it in GitHub Desktop.
Caddy log filter repro
http://localhost:8081 {
log {
format filter {
request>uri regexp `foo` `BAR`
request>uri regexp `baz` `QUUX`
}
}
respond "OK" 200
}
{
"logging": {
"logs": {
"default": {
"exclude": [
"http.log.access.log0"
]
},
"log0": {
"encoder": {
"fields": {
"request\u003euri": {
"filter": "regexp",
"regexp": "baz",
"value": "QUUX"
}
},
"format": "filter"
},
"include": [
"http.log.access.log0"
]
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":8081"
],
"routes": [
{
"match": [
{
"host": [
"localhost"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "OK",
"handler": "static_response",
"status_code": 200
}
]
}
]
}
],
"terminal": true
}
],
"automatic_https": {
"skip": [
"localhost"
]
},
"logs": {
"logger_names": {
"localhost": [
"log0"
]
}
}
}
}
}
}
}
{
"logging": {
"logs": {
"default": {
"exclude": [
"http.log.access.log0"
]
},
"log0": {
"encoder": {
"fields": {
"request\u003euri": {
"filter": "regexp",
"regexp": "foo",
"value": "BAR"
},
"request\u003euri": {
"filter": "regexp",
"regexp": "baz",
"value": "QUUX"
}
},
"format": "filter"
},
"include": [
"http.log.access.log0"
]
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":8081"
],
"routes": [
{
"match": [
{
"host": [
"localhost"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "OK",
"handler": "static_response",
"status_code": 200
}
]
}
]
}
],
"terminal": true
}
],
"automatic_https": {
"skip": [
"localhost"
]
},
"logs": {
"logger_names": {
"localhost": [
"log0"
]
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment