From c061337ce76f4b2dffc8a86340b0133538528576 Mon Sep 17 00:00:00 2001 From: Nebulosa <85841412+nebulosa2007@users.noreply.github.com> Date: Fri, 2 Jan 2026 18:11:32 +0300 Subject: [PATCH] Set log folder variable to /var/log/3x-ui (#3599) * Set log folder variable to /var/log/3x-ui * Set log folder as x-ui and create the log folder * Create the log folder in install and update scripts --- config/config.go | 2 +- install.sh | 1 + update.sh | 1 + x-ui.sh | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 17c9a77f..e5b43a29 100644 --- a/config/config.go +++ b/config/config.go @@ -109,7 +109,7 @@ func GetLogFolder() string { if runtime.GOOS == "windows" { return filepath.Join(".", "log") } - return "/var/log" + return "/var/log/x-ui" } func copyFile(src, dst string) error { diff --git a/install.sh b/install.sh index 0cf91b44..480522ed 100644 --- a/install.sh +++ b/install.sh @@ -641,6 +641,7 @@ install_x-ui() { # Update x-ui cli and se set permission mv -f /usr/bin/x-ui-temp /usr/bin/x-ui chmod +x /usr/bin/x-ui + mkdir -p /var/log/x-ui config_after_install if [[ $release == "alpine" ]]; then diff --git a/update.sh b/update.sh index ff0cea41..6da238b1 100755 --- a/update.sh +++ b/update.sh @@ -653,6 +653,7 @@ update_x-ui() { chmod +x /usr/local/x-ui/x-ui.sh >/dev/null 2>&1 chmod +x /usr/bin/x-ui >/dev/null 2>&1 + mkdir -p /var/log/x-ui >/dev/null 2>&1 echo -e "${green}Changing owner...${plain}" chown -R root:root /usr/local/x-ui >/dev/null 2>&1 diff --git a/x-ui.sh b/x-ui.sh index 32ddd8e0..8df28103 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -53,7 +53,8 @@ os_version="" os_version=$(grep "^VERSION_ID" /etc/os-release | cut -d '=' -f2 | tr -d '"' | tr -d '.') # Declare Variables -log_folder="${XUI_LOG_FOLDER:=/var/log}" +log_folder="${XUI_LOG_FOLDER:=/var/log/x-ui}" +mkdir -p "${log_folder}" iplimit_log_path="${log_folder}/3xipl.log" iplimit_banned_log_path="${log_folder}/3xipl-banned.log"