sirupsen / logrus

Structured, pluggable logging for Go.
MIT License
24.3k stars 2.26k forks source link

logrus+lumberjackrus, After the old log is deleted, the hard drive will not be released, #1404

Closed hebeillc closed 9 months ago

hebeillc commented 9 months ago

Hello, I am using logrus+lumberjackrus to regularly cut logs. After deleting old logs, I checked lsof | grep delete and found that the hard drive was not released. How did this happen? I have not found the problem yet I found that every time I restart the service, the first log of the cut is deleted and the handle is occupied.

` //supervisor restart log 2023-09-13 04:13:26,945 INFO waiting for trace-peer to stop 2023-09-13 04:13:26,998 INFO stopped: trace-peer (exit status 0) 2023-09-13 04:13:27,003 INFO spawned: 'trace-peer' with pid 970447 2023-09-13 04:13:33,101 INFO success: trace-peer entered RUNNING state, process has stayed up for > than 6 seconds (startsecs)

//lsof |grep delete result
gateway    970447  970448 gateway           gateway    8w      REG              259,1 673786529     821744 /data/trace-peer/logs/gateway-1809-2023-09-13T04-18-05.803.log (deleted)

`

hebeillc commented 9 months ago

I thought for a moment, perhaps it was caused by my setting of MaxBackups=10 and MaxAge=10?

hebeillc commented 9 months ago

someone who can help me? thanks