Skip to content

Commit

Permalink
Changed {request>user_id} to {user_id}
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenbusch authored Mar 8, 2024
1 parent 58ebafa commit ab5ff44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The module comes with one special value of `{common_log}` for the Apache Common
The more spelled out way of doing it is:

```caddyfile
format transform `{request>remote_ip} - {request>user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size}` {
format transform `{request>remote_ip} - {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size}` {
time_format "02/Jan/2006:15:04:05 -0700"
}
```
Expand All @@ -65,7 +65,7 @@ format transform `{request>remote_ip} - {request>user_id} [{ts}] "{request>metho
The more spelled out way of doing it is:

```caddy
format transform `{request>remote_ip} - {request>user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` {
format transform `{request>remote_ip} - {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` {
time_format "02/Jan/2006:15:04:05 -0700"
}
```
Expand All @@ -76,7 +76,7 @@ You can use an alternative value by using the following syntax `{val1:val2}`. Fo
header as `remote_ip` replacement you can do the following

```caddy
format transform `{request>headers>X-Forwarded-For>[0]:request>remote_ip} - {request>user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` {
format transform `{request>headers>X-Forwarded-For>[0]:request>remote_ip} - {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` {
time_format "02/Jan/2006:15:04:05 -0700"
}
```
Expand Down
2 changes: 1 addition & 1 deletion formatencoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func init() {
const (
// commonLogFormat is the common log format. https://en.wikipedia.org/wiki/Common_Log_Format
commonLogEmptyValue = "-"
commonLogFormat = `{request>remote_ip} ` + commonLogEmptyValue + ` {request>user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size}`
commonLogFormat = `{request>remote_ip} ` + commonLogEmptyValue + ` {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size}`
commonLogTimeFormat = "02/Jan/2006:15:04:05 -0700"

commonLogFormatShortcut = `{common_log}`
Expand Down

0 comments on commit ab5ff44

Please sign in to comment.