m" Y$ N h' ~( P打开httpd.conf
) D4 y- s) T. O* v找到 CustomLog logs/access_log combined這一行 在前一行加入 SetEnvIf User-Agent "(internal dummy connection)" dontlog- 1
2 j% N3 }' j8 }6 \" e6 @. E9 l
然后改写CustomLog logs 這一行,改成下面這樣(在后面加上 env=!dontlog) CustomLog logs/access_log combined env=!dontlog[root@controller httpd]# vim /etc/httpd/conf/httpd.conf 0 J7 M0 D7 I1 U0 Z# r
#
( Q7 S- V7 I2 f% [ # The location and format of the access logfile (Common Logfile Format).
6 y1 A+ j- T7 H, k # If you do not define any access logfiles within a <VirtualHost>
8 ?( Y( I0 n. A! @7 T6 u8 H # container, they will be logged here. Contrariwise, if you *do* T3 l& T! H F
# define per-<VirtualHost> access logfiles, transactions will be9 w3 k: t" u+ X
# logged therein and *not* in this file." o* |6 \( d) P8 A$ R& `7 H/ ], g5 I
#1 \% x/ V2 F$ h$ k
#CustomLog "logs/access_log" common7 `& n* {; \# Y ^5 ?1 o; I
#
0 \$ S4 {, f$ P+ H. P- D! N # If you prefer a logfile with access, agent, and referer information; |' O7 a- r4 i9 D; M9 A' z
# (Combined Logfile Format) you can use the following directive.
8 p+ u0 j5 R z# y- F1 `1 c #
, Q ?- j3 [2 [9 M; A: v1 \% f/ O SetEnvIf User-Agent "(internal dummy connection)" dontlog; u, l( a* V* \5 Q Q8 L/ m9 p8 n- f
CustomLog "logs/access_log" combined env=!dontlog
5 ?( `# K) _! r4 G& u& W</IfModule>
1 ^/ [- M8 E$ K A8 h& e5 V<IfModule alias_module>$ s2 x" Y% C. c; Q. O G
- T+ l; K9 K a* O* B( `# _9 F重启apache (systemctl restart httpd.service) 生效
$ \, D' X2 W% d' N, Q2 W
. ~# X5 U& E6 f C9 F4 L5 ]3 j& G |