-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFE] filter/split access logs by fields other than hostname #5978
Comments
Interesting. I can see a way we could do this. We'd need to adjust caddy/modules/caddyhttp/logging.go Line 61 in 7d919af
GetVar() to get a special variable like access_logger_name or something like that which is an override for the logger name for the current context. The user could do something like:
PRs welcome if you want to take a crack at it. |
Yup, exactly. For me, at least, it is not really high priority. And I would probably see whether other users +1'd this idea. |
@francislavoie Is this still up for grabs? I would like to take a crack at it. |
@armadi1809 yeah, still up for grabs. Thing is though, I'm not 100% convinced that doing this is a good idea because it makes an already complex logging system even more complex. This functionality might be hard to document and explain. Anyway this is sorta what I was envisioning (run
This Caddyfile ☝️ produces sensible JSON config. The logger names only has The problem is that if you order the We'd need to think of a way to tell the Caddyfile adapter to ignore a given logger (i.e. Also I took a look a the code, we'll need to move around the call to |
That makes sense. I guess I will start the implementation and try to keep you in the loop. We'll then decide if we end up rolling with it or not. Thank you! |
Thanks! Even if you did not implement it, no blocker for me. Just thought it might be useful for others as well. Sorting out load balancer requests etc. Makes log files easier to browse locally. That's all. |
Hi!
Currently, I can create an access log like so:
However, with many health checks coming in, I would redirect all known User-Agents for health checks to its own log file:
Of course this is pseudo syntax, but I think you get the idea.
For reference, in Apache httpd I can write something like this:
The text was updated successfully, but these errors were encountered: