ats日志过滤

392 <LogFormat>

393      <Name = "access"/>

394      <Format = "%<chi> - [%<cqtn>] %<cqhm> %<cquc>/%<cqhv> %<pssc> %<psql> %<crc> %<phr>/%<pqsn> \"%<{User-Agent}cqh>\" %<psct>"/>

395 </LogFormat>

396

397 <LogFilter>

398     <Name = "test_access"/>

399     <Condition = "psct CASE_INSENSITIVE_CONTAIN text/html"/>

400     <Action = "REJECT"/>

401 </LogFilter>

402

403 <LogObject>

404      <Format = "access"/>

405      <Filename = "access"/>

406      <Filters = "test_access"/>

407 </LogObject>


1.这里自定义了日志格式access.log,

2.定义了一个日志收集方式,一个过滤条件,把产生text/html文件的日志过滤掉,非text/html文件日志将写到本地日志

access.log中。



3.自定义日志:

   主配置文件records.config:

     proxy.config.log.squid_log_enabled INT 0     关闭squid日志

     proxy.config.log.custom_logs_enabled INT 1     开启自定义日志指令


日志文件logs_xml.config:

<LogFormat>

     <Name = "access"/>

     <Format = "%<chi> - [%<cqtn>] \"%<cqhm> %<cquc> TCP/%<cqhv>\" %<pssc> %<psql> \"%<{Referer}cqh>\" \"%<{User-Agent}cqh>\" \"%<crc>\" \"%<{Cookie}cqh>\" \"%<caun>\" "/>

</LogFormat>

<LogObject>

     <Format = "access"/>

     <Filename = "access"/>

</LogObject>


<LogFormat>

     <Name = "atslog"/>

     <Format = "%<cquuh> %<chi> %<cqtq> %<crc> [%<cqtn>] \"%<cqhm> /%<cqup> %<cqhv>\" %<pssc> %<psql> \"%<{Referer}cqh>\" \"%<caun>\" \"%<{Cookie}cqh>\" \"%<{User-Agent}cqh>\" %<cqhv> %<cqbl> %<sts> "/>

</LogFormat>

<LogObject>

     <Format = "atslog"/>

     <Filename = "atslog"/>

</LogObject>


4.此处定义了两种日志格式,access.log和atslog.log

  这个是access.log日志:

192.168.199.108 - [19/Jun/2015:16:39:49 +0800] "GET http://www.test100.com/test2.html TCP/HTTP/1.1" 200 539 "-" "curl/7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 NSS/3.12.7.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2" "TCP_MEM_HIT" "-" "-"

192.168.199.108 - [19/Jun/2015:16:40:01 +0800] "GET http://www.test100.com/test2.html TCP/HTTP/1.0" 200 540 "-" "Wget/1.12 (linux-gnu)" "TCP_MEM_HIT" "-" "-"


这个是atslog.log日志

www.test100.com 192.168.199.108 1434703188.161 TCP_HIT [19/Jun/2015:16:39:48 +0800] "GET /test2.html HTTP/1.1" 200 539 "-" "-" "-" "curl/7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 NSS/3.12.7.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2" HTTP/1.1 0 0

www.test100.com 192.168.199.108 1434703189.840 TCP_MEM_HIT [19/Jun/2015:16:39:49 +0800] "GET /test2.html HTTP/1.1" 200 539 "-" "-" "-" "curl/7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 NSS/3.12.7.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2" HTTP/1.1 0 0






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值