You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "darkSheep404 (via GitHub)" <gi...@apache.org> on 2025/01/15 06:59:26 UTC

[I] bug: log-rotate not work when access log is file and error log `/dev/stderr` [apisix]

darkSheep404 opened a new issue, #11915:
URL: https://github.com/apache/apisix/issues/11915

   ### Current Behavior
   
   when access log is a file and error log is `/dev/stderr`
   log-rotate will not work
   cause it will attempts to rename and move error log  which is `/dev/stderr` and get a  error : 
   ```lua
   log-rotate.lua:150: rename_file(): move file from /dev/stderr to /dev//2025-01-13_08-50-00__stderr
    res:nil msg:/dev/stderr: Permission denied, context: ngx.timer
   ```
   and successfully rename and move `access.log` to `2025-01-13_08-50-00__access.log`
   Then it will return and do not exec `signal.kill(pid, signal.signum("USR1"))`, access log keep writing to `2025-01-13_08-50-00__access.log` and no new `access.log` be created.
   so, when next time do log rotate
   will get an error like below 
   ```lua
   move file from /usr/local/apisix/logs/access.log to /usr/local/apisix/logs//2025-01-13_08-37-00__access.log res:nil msg:/usr/local/apisix/logs/access.log: No such file or directory, context: ngx.timer
   ```
   
   ### Expected Behavior
   
   log rotate should work normally when error_log or access log are set to /dev/stderr.
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   set error_log to `/dev/stderr` 
   ```yml
   nginx_config:
     error_log: /dev/stderr
   ```
   
   ### Environment
   
   - APISIX version (3.9.0)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: log-rotate not work when access log is file and error log `/dev/stderr` [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #11915: bug: log-rotate not work when access log is file and error log `/dev/stderr`
URL: https://github.com/apache/apisix/issues/11915


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: log-rotate not work when access log is file and error log `/dev/stderr` [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #11915:
URL: https://github.com/apache/apisix/issues/11915#issuecomment-4043820475

   Closing this due to inactivity. If there’s still interest in this feature, please let us know!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: log-rotate not work when access log is file and error log `/dev/stderr` [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #11915:
URL: https://github.com/apache/apisix/issues/11915#issuecomment-2896837051

   I think we can add a judgment for special device files in log-rotate, such as detecting if the path starts with “/dev/”.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: log-rotate not work when access log is file and error log `/dev/stderr` [apisix]

Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on issue #11915:
URL: https://github.com/apache/apisix/issues/11915#issuecomment-2676372787

   It doesn't make much sense why log-rotate would need to be used or work properly if the error logs will be output to a standard error device.
   
   When you use /dev/stderr, log truncation or ratating here should be managed by the docker daemon (for container) or systemd (for bare metal), not APISIX itself. So at this point APISIX should ignore the error_log path and not rotate.
   
   However, APISIX itself can't tell which paths don't make sense to rotate, and perhaps just hard-coding /dev/stderr isn't enough, so perhaps you shouldn't use a dev and a file at the same time, which does cause problems with log-rotate.
   
   What do you think?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org