[PR #1120] Add logrotate support: reopen log file on SIGHUP #1513

Open
opened 2026-05-05 04:35:57 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1120
Author: @extracomplex
Created: 5/28/2024
Status: 🔄 Open

Base: mainHead: logrotate


📝 Commits (1)

  • 23e88a5 Add logrotate support: reopen log file on SIGHUP

📊 Changes

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

View changed files

📝 cmd/serve.go (+11 -7)
📝 log/log.go (+17 -0)

📄 Description

Log file stays opened while server process running.
In production environment log file usually grows fast. Best practice is periodic log file rotation: ntfy.log moves to ntfy.log.1, ntfy.log.1 to ntfy.log.2 and so on. Then new empty ntfy.log file is created.
But in Linux the process continues logging to the original file despite it was renamed.
Added log file close & open on SIGHUP.


🔄 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/binwiederhier/ntfy/pull/1120 **Author:** [@extracomplex](https://github.com/extracomplex) **Created:** 5/28/2024 **Status:** 🔄 Open **Base:** `main` ← **Head:** `logrotate` --- ### 📝 Commits (1) - [`23e88a5`](https://github.com/binwiederhier/ntfy/commit/23e88a5555d37179546717857a8f1388490c971a) Add logrotate support: reopen log file on SIGHUP ### 📊 Changes **2 files changed** (+28 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `cmd/serve.go` (+11 -7) 📝 `log/log.go` (+17 -0) </details> ### 📄 Description Log file stays opened while server process running. In production environment log file usually grows fast. Best practice is periodic log file rotation: ntfy.log moves to ntfy.log.1, ntfy.log.1 to ntfy.log.2 and so on. Then new empty ntfy.log file is created. But in Linux the process continues logging to the original file despite it was renamed. Added log file close & open on SIGHUP. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 04:35:57 -06: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: github-starred/ntfy#1513
No description provided.