Logging

SSH LogLevels

Log Levels for SSH In SSH, the LogLevel option allows you to control the level of logging information generated by the SSH client and server. There are several log levels you can use to adjust the verbosity of SSH logging. Here are the most commonly used log levels: QUIET: Suppresses all log messages, except for fatal errors. It provides the least amount of information. FATAL: Logs only fatal errors, indicating severe issues that may prevent the SSH session from being established.

Python Logger

a custom logger for Python let’s tune the default logger a bit so he write nice and colored messages. Screenshot config.py a little config File … cat <<'EOF'> config.py LOGGER_MAX_FILE_LENGTH = 10 EOF src/logger.py the logger code in the ‘src’ Folder mkdir src cat <<'EOF'> src/logger.py import logging import datetime import sys from config import * if isinstance(LOGGER_MAX_FILE_LENGTH, int): LOGGER_MAX_FILE_LENGTH = str(LOGGER_MAX_FILE_LENGTH) def get_now() -> str: # # choose your format # current_time = datetime.

Nginx - Log Headers

How to enable Logging with Headers for Nginx Assuming you have a running setup and you want to enable logging with headers for debug and learning purposes ? Add Lua doas pkg_add nginx-lua-- and you get … doas pkg_info -L nginx-lua-- Information for inst:nginx-lua-1.20.1p0 Files: /var/www/modules/ndk_http_module.so /var/www/modules/ngx_http_lua_module.so Enable Modules in /etc/nginx/nginx.conf add two lines on Top load_module "modules/ndk_http_module.so"; load_module "modules/ngx_http_lua_module.so"; Enhance Logging add the following to the “http” Section log_format log_req_resp '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" ' '$request_time req_header:"$req_header" ' 'resp_header:"$resp_header"'; Enable Logging add the following lines to your virtual Host Section