3 k* r. W* N& z/ b打开httpd.conf # O$ k+ p% u7 ^# M& n- }( w& k
找到 CustomLog logs/access_log combined這一行 在前一行加入 SetEnvIf User-Agent "(internal dummy connection)" dontlog- 1
1 ^0 ]2 d* @' W$ i. ?! w
然后改写CustomLog logs 這一行,改成下面這樣(在后面加上 env=!dontlog) CustomLog logs/access_log combined env=!dontlog[root@controller httpd]# vim /etc/httpd/conf/httpd.conf 1 N9 G% P- [5 z' z) ^; Y4 x1 V
#
4 O' n7 [: K! D8 U # The location and format of the access logfile (Common Logfile Format).
! q" C; W' D# Y # If you do not define any access logfiles within a <VirtualHost>1 [( Z m, o1 R( Q
# container, they will be logged here. Contrariwise, if you *do*
( ^5 @. Z5 O" j0 C2 ]; b5 U, D% \ # define per-<VirtualHost> access logfiles, transactions will be
( q' o: o1 q) P' { # logged therein and *not* in this file.
" `# j; J0 @9 o' t, ] #
8 m, _) N- } S' s7 |$ g #CustomLog "logs/access_log" common5 u8 E+ d: c% U7 E4 o4 W; t6 D
#, C: x7 Z& ?( g1 q; ^6 {' ^
# If you prefer a logfile with access, agent, and referer information
% h& {6 Y+ J4 t # (Combined Logfile Format) you can use the following directive.( m, R1 H' d; f7 j' u# E
#
$ O7 @3 f6 c) y1 u3 R! B# w6 d" A SetEnvIf User-Agent "(internal dummy connection)" dontlog
: O; Y. _* d0 G! }) g8 w: B CustomLog "logs/access_log" combined env=!dontlog
' E- r; c. _$ I' N/ a0 N2 t</IfModule>
: @6 t/ K. y. G* i<IfModule alias_module>
& \5 ~. k. I: y$ ^
, l% h& d& Z5 S, I重启apache (systemctl restart httpd.service) 生效
+ ?6 @3 h: N- E! |0 }& z
# h9 k: s- v' w. { |