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>
This commit is contained in:
committed by
Dietmar Maurer
parent
081c37cccf
commit
8e7e2223d8
@ -63,6 +63,8 @@ async fn run() -> Result<(), Error> {
|
||||
config.register_template("index", &indexpath)?;
|
||||
config.register_template("console", "/usr/share/pve-xtermjs/index.html.hbs")?;
|
||||
|
||||
config.enable_file_log(buildcfg::API_ACCESS_LOG_FN)?;
|
||||
|
||||
let rest_server = RestServer::new(config);
|
||||
|
||||
//openssl req -x509 -newkey rsa:4096 -keyout /etc/proxmox-backup/proxy.key -out /etc/proxmox-backup/proxy.pem -nodes
|
||||
|
Reference in New Issue
Block a user