[PR #3575] [MERGED] feat: add file logger support #5448

Closed
opened 2026-10-31 20:47:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3575
Author: @slavafyi
Created: 10/7/2025
Status: ✅ Merged
Merged: 10/9/2025
Merged by: @MHSanaei

Base: main ← Head: feature/file-logger


📝 Commits (2)

📊 Changes

2 files changed (+100 additions, -28 deletions)

View changed files

📝 logger/logger.go (+99 -27)
📝 sub/sub.go (+1 -1)

📄 Description

Hey there!

What is the pull request?

I faced a problem when using 3x-ui in Docker. I use this in my homelab along with other containers, so I don't want to setup it directly on the host. I want to ban those who try to access 3xui panel. But I found that the panel logs were only stored in memory, so fail2ban running on the host couldn't track them. This change adds a small modification to the logger to write each entry to ${XUI_LOG_FOLDER}/3xui.log. With this file, fail2ban can monitor the container logs just as it does today for IP Limit logs.

I'm not a go developer, so if it looks bad, let me know if it's possible to add logs to file in another way. Thank you!

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3575 **Author:** [@slavafyi](https://github.com/slavafyi) **Created:** 10/7/2025 **Status:** ✅ Merged **Merged:** 10/9/2025 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feature/file-logger` --- ### 📝 Commits (2) - [`9181ca8`](https://github.com/MHSanaei/3x-ui/commit/9181ca8a9d51f574a32806fef7271babd4cd1eae) feat: add backend for file logger - [`62123b1`](https://github.com/MHSanaei/3x-ui/commit/62123b1d4071642ad751c9a5c5e67c6248acf3c9) fix ### 📊 Changes **2 files changed** (+100 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `logger/logger.go` (+99 -27) 📝 `sub/sub.go` (+1 -1) </details> ### 📄 Description Hey there! ## What is the pull request? I faced a problem when using 3x-ui in Docker. I use this in my homelab along with other containers, so I don't want to setup it directly on the host. I want to ban those who try to access 3xui panel. But I found that the panel logs were only stored in memory, so fail2ban running on the host couldn't track them. This change adds a small modification to the logger to write each entry to `${XUI_LOG_FOLDER}/3xui.log`. With this file, fail2ban can monitor the container logs just as it does today for IP Limit logs. I'm not a go developer, so if it looks bad, let me know if it's possible to add logs to file in another way. Thank you! ## Which part of the application is affected by the change? - [ ] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [x] New feature - [x] Refactoring - [ ] Other --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:47:03 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5448
No description provided.