更改 syslog 日志路径
如何在运行时更改 syslog 守护进程的日志路径?我的目标是每个文件大小或日期轮换日志文件,但我在 QNX/POSIX 中没有 logrotate。
我是否只是进行编辑并希望 syslogd 每次都检查 .conf 文件,还是有其他解决方法?谢谢。
澄清:出于可移植性问题,必须使用 C 或 C++ 完成,而不是使用脚本和控制台命令行。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到 syslogd 的 pid。假设是 123。然后,在完成编辑后,
在命令行上,键入以下内容之一:
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:
答案基于在网上找到的一些解决方案,也基于@bills答案,经过修改以适应QNX环境。
对
slay syslogd
执行系统调用,并对syslog.conf
执行编辑,然后再次对syslogd
执行系统调用。QNX 不提供 logrotate,除上述答案外,安装第三方日志记录是另一种解决方法,尽管不符合我的目的。
更新:经过一番挖掘,QNX 在 Neutrino OS 中提供了一个名为
slogger
的替代方案。我将投票支持这个答案,因为它迎合 QNX 系统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 tosyslog.conf
and system call tosyslogd
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在我看来,您最好将 newsyslog 移植到您的平台。
Sounds to me you're best helped with porting newsyslog to your platform.