[[FrontPage]]
 
 先にこちらを見たほうが良いかも。(2004-04-04) ~
 http://squid.robata.org/faq_6.html#l-04
 
 
 ----
 「時刻 squid」でググって
 
  perl -pe 's/\d+\.\d+/localtime $&/e'
 
 が正解。参考
 [[squid log 時刻変換:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/21587]] とか
 [[squid 設定方法:http://www.hidanet.ne.jp/~haya/squid.html]]
 
 
 ** squidのログの時刻
 
 squid のログは 
  882008749.530    522 127.0.0.1 TCP_MISS/200 1556 GET http://localhost/ - DIRECT/localhost text/html
 のように先頭がunix時間に記録されているのをローカルタイムに変換するフィルターのperlスクリプト。
 
 onelinerに出来そうだけど深い追いはしない。
 
 #ref(squid-log-time.pl)
 
  #! /usr/bin/perl
  
  while( <>){
    chop;
    ($time, $rest) = /([0-9.]+)[  ]+(.*)/;
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                    localtime($time);
   $mon++;
  $year += 1900;
    print "$year-$mon-$mday $hour:$min:$sec $rest\n";
  }
 
 先の例はこのように変換される。
  1997-12-13 19:25:49 522 127.0.0.1 TCP_MISS/200 1556 GET http://localhost/ - DIRECT/localhost text/html

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS