正如这个答案建议的那样,我激活了我生成的一个.plist文件的日志记录。
<key>StandardOutPath</key>
<string>/path/to/logfile.log</string>
<key>StandardErrorPath</key>
<string>/path/to/another_logfile.log</string>但是,日志文件正在慢慢变大,我想知道是否有一种方法可以限制日志在.plist文件中的大小?
发布于 2019-11-05 10:10:32
我无法在.plist文件中找到这样的方法,但是使用新系统日志 (旋转日志文件)似乎是前进的方向。
/etc/newsyslog.conf<log filename> [owner:group] mode count size when flags [/pid_file] [sig_num]sudo newsyslog -nvv验证配置文件是否正确因此,例如,从问题中,我将向/etc/newsyslog.conf添加以下内容:
/path/to/logfile.log 644 2 1000 * J
/path/to/another_logfile.log 644 2 1000 * Jroot可以改变它,其他人都可以读)bzip压缩旋转日志文件来节省磁盘空间)有关更多信息,请参见newsyslog手册。
发布于 2019-11-04 20:13:09
我刚刚从作业本身中删除了文件:)
> /path/to/logfile.loghttps://serverfault.com/questions/900499
复制相似问题