在 Mac OS X 10.6 上限制 Apache 日志

One*_*ema 3 log-files apache-2.2

昨天我发现我的开发机器中的 Apache 日志文件大小接近 50 GB。

有没有办法限制Apache日志文件的站点?

War*_*ner 5

这通常使用logrotate 完成。Apache 的 logrotate 配置示例:

/var/log/httpd/*log {
    daily
    rotate 30
    compress
    missingok
    notifempty
    sharedscripts
    postrotate
      /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}
Run Code Online (Sandbox Code Playgroud)

  • Mac OS 10.5 及更高版本使用 newsyslog,配置文件位于 /etc/newsyslog.conf。man newsyslog 和 man newsyslog.conf 应该有很大帮助!! (2认同)