]> git.proxmox.com Git - proxmox-backup.git/commit
server/rest: implement request access log
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Oct 2020 09:06:46 +0000 (11:06 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Oct 2020 09:23:49 +0000 (11:23 +0200)
commit8e7e2223d8bedf28df964b65a6ed5a3600c6e57c
treedac683f7ad76b1dfb673d7d13f63ebf81fd3da38
parent081c37cccffd89c42e67c45e517f355e0aa73651
server/rest: implement request access log

reuse the FileLogger module in append mode.
As it implements write, which is not thread safe (mutable self) and
we use it in a async context we need to serialize access using a
mutex.

Try to use the same format we do in pveproxy, namely the one which is
also used in apache or nginx by default.

Use the response extensions to pass up the userid, if we extract it
from a ticket.

The privileged and unprivileged dameons log both to the same file, to
have a unified view, and avoiding the need to handle more log files.
We avoid extra intra-process locking by reusing the fact that a write
smaller than PIPE_BUF (4k on linux) is atomic for files opened with
the 'O_APPEND' flag. For now the logged request path is not yet
guaranteed to be smaller than that, this will be improved in a future
patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/bin/proxmox-backup-api.rs
src/bin/proxmox-backup-proxy.rs
src/buildcfg.rs
src/server/config.rs
src/server/rest.rs