mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
better access log
This commit is contained in:
parent
e5dfc9e306
commit
d7fb06d22e
@ -6,6 +6,7 @@ kvmd:
|
|||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 8081
|
port: 8081
|
||||||
heartbeat: 3.0
|
heartbeat: 3.0
|
||||||
|
access_log_format: "[%{X-Real-IP}i] '%r' => %s; size=%b --- referer='%{Referer}i'; user_agent='%{User-Agent}i'"
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
htpasswd: /etc/kvmd/htpasswd
|
htpasswd: /etc/kvmd/htpasswd
|
||||||
|
|||||||
@ -6,6 +6,7 @@ kvmd:
|
|||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 8081
|
port: 8081
|
||||||
heartbeat: 3.0
|
heartbeat: 3.0
|
||||||
|
access_log_format: "[%{X-Real-IP}i] '%r' => %s; size=%b --- referer='%{Referer}i'; user_agent='%{User-Agent}i'"
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
htpasswd: /etc/kvmd/htpasswd
|
htpasswd: /etc/kvmd/htpasswd
|
||||||
|
|||||||
@ -94,6 +94,7 @@ def main() -> None:
|
|||||||
msd=msd,
|
msd=msd,
|
||||||
streamer=streamer,
|
streamer=streamer,
|
||||||
|
|
||||||
|
access_log_format=str(config["server"]["access_log_format"]),
|
||||||
heartbeat=float(config["server"]["heartbeat"]),
|
heartbeat=float(config["server"]["heartbeat"]),
|
||||||
streamer_shutdown_delay=float(config["streamer"]["shutdown_delay"]),
|
streamer_shutdown_delay=float(config["streamer"]["shutdown_delay"]),
|
||||||
msd_chunk_size=int(config["msd"]["chunk_size"]),
|
msd_chunk_size=int(config["msd"]["chunk_size"]),
|
||||||
|
|||||||
@ -198,6 +198,7 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
msd: MassStorageDevice,
|
msd: MassStorageDevice,
|
||||||
streamer: Streamer,
|
streamer: Streamer,
|
||||||
|
|
||||||
|
access_log_format: str,
|
||||||
heartbeat: float,
|
heartbeat: float,
|
||||||
streamer_shutdown_delay: float,
|
streamer_shutdown_delay: float,
|
||||||
msd_chunk_size: int,
|
msd_chunk_size: int,
|
||||||
@ -214,6 +215,7 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
self.__msd = msd
|
self.__msd = msd
|
||||||
self.__streamer = streamer
|
self.__streamer = streamer
|
||||||
|
|
||||||
|
self.__access_log_format = access_log_format
|
||||||
self.__heartbeat = heartbeat
|
self.__heartbeat = heartbeat
|
||||||
self.__streamer_shutdown_delay = streamer_shutdown_delay
|
self.__streamer_shutdown_delay = streamer_shutdown_delay
|
||||||
self.__msd_chunk_size = msd_chunk_size
|
self.__msd_chunk_size = msd_chunk_size
|
||||||
@ -251,17 +253,23 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
assert port or unix_path
|
assert port or unix_path
|
||||||
if unix_path:
|
if unix_path:
|
||||||
kwargs: Dict = {}
|
socket_kwargs: Dict = {}
|
||||||
if unix_rm and os.path.exists(unix_path):
|
if unix_rm and os.path.exists(unix_path):
|
||||||
os.remove(unix_path)
|
os.remove(unix_path)
|
||||||
server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
server_socket.bind(unix_path)
|
server_socket.bind(unix_path)
|
||||||
if unix_mode:
|
if unix_mode:
|
||||||
os.chmod(unix_path, unix_mode)
|
os.chmod(unix_path, unix_mode)
|
||||||
kwargs = {"sock": server_socket}
|
socket_kwargs = {"sock": server_socket}
|
||||||
else:
|
else:
|
||||||
kwargs = {"host": host, "port": port}
|
socket_kwargs = {"host": host, "port": port}
|
||||||
aiohttp.web.run_app(app, print=self.__run_app_print, **kwargs)
|
|
||||||
|
aiohttp.web.run_app(
|
||||||
|
app=app,
|
||||||
|
access_log_format=self.__access_log_format,
|
||||||
|
print=self.__run_app_print,
|
||||||
|
**socket_kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
async def __make_info(self) -> Dict:
|
async def __make_info(self) -> Dict:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ kvmd:
|
|||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 8081
|
port: 8081
|
||||||
heartbeat: 3.0
|
heartbeat: 3.0
|
||||||
|
access_log_format: "[%{X-Real-IP}i] '%r' => %s; size=%b --- referer='%{Referer}i'; user_agent='%{User-Agent}i'"
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
htpasswd: /etc/kvmd/htpasswd
|
htpasswd: /etc/kvmd/htpasswd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user