Skip to content

Commit 550ad38

Browse files
committed
request logging
1 parent 5014046 commit 550ad38

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

content/features/proxy/examples.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,45 @@ routes{
241241
},
242242
}
243243
```
244+
245+
## Request logging
246+
247+
Results of requests to backend pools can be selectively enabled in the
248+
configuration. Logs can then be viewed by connecting and running `watch
249+
proxyreqs` - Log lines are not generated internally a connection is reading
250+
them, but it is still recommended to configure the `rate` option or other
251+
constraints.
252+
253+
Logs look like: `ts=time gid=num type=proxy_req elapsed=us type=num
254+
code=num status=num res=num cfd=fdnum be=host:port detail=tag req=get key\n`
255+
256+
```lua
257+
settings{
258+
backend_options = {
259+
log = {
260+
rate = 5, -- log one out of every 5 by random chance
261+
errors = true, -- log all errors
262+
deadline = 250, -- log all results slower than 250ms
263+
tag = "all" -- informational tag for log
264+
}
265+
}
266+
}
267+
268+
pools{
269+
main = {
270+
-- per-pool logging options.
271+
--[[backend_options = {
272+
-- if no constraints given, log everything (SLOW!)
273+
log = { tag = "mainpool" }
274+
},--]]
275+
backends = {
276+
"127.0.0.1:11214",
277+
"127.0.0.1:11215",
278+
}
279+
}
280+
}
281+
282+
routes{
283+
default = route_direct{ child = "main" }
284+
}
285+
```

0 commit comments

Comments
 (0)