Changing syslog log path

独自空忆成欢 提交于 2021-01-27 23:30:43

问题


How do I change the log path of syslog daemon during runtime? My goal is to rotate log file every filesize or date, but I don't have logrotate in QNX/POSIX.

Do I just do an edit and hope that the syslogd checks the .conf file everytime, or is there any other workaround? Thanks.

Clarification: It has to be done in C or C++, not in script and console command line, for portabality issues.


回答1:


Find the pid of syslogd. Let's say it's 123. Then, after you've finished your edit, on the command line, type one of these:

kill -HUP 123
kill -1 123



回答2:


Answer based on some solution found on web, and also based on @bills answer, modified to suit QNX environment.

Perform a system call for slay syslogd and perform edit to syslog.conf and system call to syslogd again.

QNX does not supply logrotate, otherwise other than the above answer, install third party logging is another workaround, though does not fit my purpose.

update: After some digging, QNX provides a alternative called slogger within Neutrino OS. I'll be voting for this as an answer as it is catering to QNX system




回答3:


Sounds to me you're best helped with porting newsyslog to your platform.



来源:https://stackoverflow.com/questions/5976277/changing-syslog-log-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!