---
title: "按日期生成apache日志"
author: "godlogin"
date: "2012-07-04T07:50:47Z"
tags: []
categories: ["Web前端"]
slug: "apache"
draft: false
lastmod: "2012-07-04T07:51:18Z"
id: 1576164
url: "https://godlogin.iteye.com/blog/1576164"
---

在httpd.conf配置文件中找到


```conf

ErrorLog logs/error_log
CustomLog logs/access_log common

```


修改为

```conf

ErrorLog “| /usr/sbin/rotatelogs /home/logs/www/%Y_%m_%d_error_log 86400 480″
CustomLog “| /usr/sbin/rotatelogs /home/logs/www/%Y_%m_%d_access_log 86400 480″ common

```


重启apache


参考文章：http://hi.baidu.com/wenlongzhao/item/9deb7ab74f981165254b09fe