Apache ログ

ログ出力抑制

no_log

なおaccess_logの方の404の記録を弾くにはSetEnvIf Request_URI "\.ico$" no_log
CustomLog /dev/shm/access_log combined env=!no_log

http://www.accessup.org/pj/6_B4C9CDFDBFCDA4B5A4F3/20090725.html

nolog

SetEnvIf User-Agent "ELB-HealthChecker.*" nolog
SetEnvIf User-Agent "ELB-HealthChecker.*" fromelb
SetEnvIf Request_URI "\.(jpg|png|gif|css|js)$" nolog 

CustomLog logs/access_log combined env=!nolog
CustomLog logs/healthcheck_log combined env=fromelb

のように書けば簡単に対処出来ました。
インフラ関係のメモ書き | Apacheで特定の条件にSetEnvIfで複数の環境変数を設定する 2014

dontlog

# Mark requests from the loop-back interface
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# Mark requests for the robots.txt file
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# Log what remains
CustomLog logs/access_log common env=!dontlog

https://httpd.apache.org/docs/2.4/ja/logs.html

dolog

      
        SetEnvIf Request_URI "/luproxy/" dolog
        SetEnvIf Request_URI "/luproxy/.*_livetri.zip" no-cache
        CustomLog "|| bin/rotatelogs.exe logs/access-%Z.log 25M" common env=dolog
      

https://knowledge.broadcom.com/external/article/227924/apache-web-mac-linux-liveupdate.html

サイズ %b

%b レスポンスのバイト数。HTTP ヘッダは除く。CLF 書式。 すなわち、1 バイトも送られなかったときは 0 ではなく、 '-' になる
https://httpd.apache.org/docs/2.4/ja/mod/mod_log_config.html

deflate_module で圧縮した場合は圧縮後のサイズになる

バーチャルホスト

https://httpd.apache.org/docs/2.4/ja/logs.html#virtualhosts

<VirtualHost *:80>
  ServerName example.com
  ServerAlias alias.example.com

alias.example.com でアクセスした場合

%v → example.com

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

%{Host} → alias.example.com

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Host}i\"" combinedhost