mysql建表
CREATE TABLE IF NOT EXISTS `apachelog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`status` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`ip` char(15) COLLATE utf8_bin DEFAULT NULL,
`dateTime` datetime DEFAULT NULL,
`url` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`requestUrl` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`dealTime` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`test1` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`test2` varchar(100) COLLATE utf8_bin DEFAULT NULL,
`test3` text COLLATE utf8_bin,
PRIMARY KEY (`id`),
KEY `ip` (`ip`),
KEY `status` (`status`,`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1;
apache httpd.confi
在<IfModule log_config_module>下面添加
LogFormat "USE log;INSERT INTO apachelog (id,username,status,ip,dateTime,url,requestUrl,dealTime,size,test1,test2,test3) VALUES ( NULL ,\"%u\", \"%s\",\"%a\",\"%{%Y-%m-%d %H:%M:%S}t\", \"%U\",\"%q\",\"%T\",\"%b\",\"%C\",\"%i\",\"%r\");" sql
CustomLog "| C:/mysql5.5/bin/mysql -u root" sql