On Tue, Aug 25, 2020 at 3:56 PM Willy Tarreau <w...@1wt.eu> wrote: > There was something important I've been wanting for a few versions, which > was to have named log formats that we could declare in a central place and > use everywhere. It would tremendously help here. I know it can be done > using environment variables declared in the global section but I personally > find this ugly. > > So I think it's the right place to open such a discussion (what we should > log and whether or not it loses info by default or requires to duplicate > some data while waiting for the response), so that we can reach a better > and more modern solution. I'm open to proposals.
If we are to talk about logging, please make it easy to have valid JSON log lines. I know there is the `%[something(),json()]` that works as expected; however there are many (especially old) log items (say `%ST`) that sometimes expand to a number, and sometimes to a `-`, which basically means one has to always treat everything as strings, and hope the actual value doesn't contain a quote or JSON escape codes... In fact, to keep things simple, I would suggest just adding new functions (fetch samples as they are called) that expose all items available in the `Custom log format` section (some are available, some are not from what I remember); these should expand to an empty string if they are not available (as opposed to a `-`). Also what would be extra useful, especially for debugging and perhaps security, is to add an `http-request|http-response log <level> <log-format> if <condition>` that would allow adding additional log lines if a certain condition is met. Thanks, Ciprian.