8 _, Z* x2 z: f2 o$ ]0 j! \
打开httpd.conf
9 b4 `: s8 f! o T! ~7 g" o+ Z, p找到 CustomLog logs/access_log combined這一行 在前一行加入 SetEnvIf User-Agent "(internal dummy connection)" dontlog- 17 K: N P, v% P$ `- t$ \; B
然后改写CustomLog logs 這一行,改成下面這樣(在后面加上 env=!dontlog) CustomLog logs/access_log combined env=!dontlog[root@controller httpd]# vim /etc/httpd/conf/httpd.conf
! F! J' a( j- J) S# D #1 d" B5 D9 p6 _" j+ a
# The location and format of the access logfile (Common Logfile Format).9 Q6 h# i- C8 H
# If you do not define any access logfiles within a <VirtualHost>
: n' n. J4 W/ U, S # container, they will be logged here. Contrariwise, if you *do*- h+ F9 X8 R0 X2 }2 }1 _5 ?
# define per-<VirtualHost> access logfiles, transactions will be! b) s7 z- z: H' f0 V" q
# logged therein and *not* in this file.
4 Q O8 C {7 A, {5 l/ x #5 z* F* ]& k- ]# F {
#CustomLog "logs/access_log" common
: a, ^9 q+ R6 J2 z9 {, C% z% C #
9 T8 z' M" f0 V4 ] # If you prefer a logfile with access, agent, and referer information
3 |. _( G8 ]: T- f* U6 r # (Combined Logfile Format) you can use the following directive.3 I& Y6 Y, m: t7 w: g- o
#; j% p4 K2 m: o; j) ]0 w
SetEnvIf User-Agent "(internal dummy connection)" dontlog
2 p9 R2 V* \* Z1 p" p. A5 ]! O CustomLog "logs/access_log" combined env=!dontlog+ V; l% I# p( }1 C' n$ m0 @
</IfModule>4 ?- H/ i4 x h+ t
<IfModule alias_module>
1 o7 W6 `6 ~5 |7 J3 k7 Q5 R5 d( O9 a3 t8 P) l. R- ]0 J. j6 M
重启apache (systemctl restart httpd.service) 生效
( j! u2 i, U9 A+ T( _+ k' K
, @/ j; J, U+ l; V$ _ |