Rek*_*vni 6 mac-osx launchd launchctl
正如这个答案所建议的那样,我激活了.plist
我生成的文件的日志记录。
<key>StandardOutPath</key>
<string>/path/to/logfile.log</string>
<key>StandardErrorPath</key>
<string>/path/to/another_logfile.log</string>
Run Code Online (Sandbox Code Playgroud)
但是,日志文件正在慢慢变大,我想知道是否有办法限制日志在.plist
文件中的大小?
我找不到在文件中执行此操作的方法.plist
,但是使用newsyslog(旋转日志文件)似乎是前进的方向。
脚步:
/etc/newsyslog.conf
<log filename> [owner:group] mode count size when flags [/pid_file] [sig_num]
Run Code Online (Sandbox Code Playgroud)
sudo newsyslog -nvv
例如,从问题中,我将添加以下内容/etc/newsyslog.conf
:
/path/to/logfile.log 644 2 1000 * J
/path/to/another_logfile.log 644 2 1000 * J
Run Code Online (Sandbox Code Playgroud)
root
可以更改,其他人都可以读取)bzip
)有关详细信息,请参阅newsyslog 手册。
归档时间: |
|
查看次数: |
884 次 |
最近记录: |