pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

$.ajaxで一秒毎にサーバーとDIOの入力情報を更新するようにしたれどapacheのログが

2012-03-04 08:06:22 | Linux

Remote-Hand_DIO V.20より
 $.ajax通信で一秒毎にサーバーとDIOの入力情報を更新するようにはしたれどapacheのログが溜まる溜まるわ

[root@~]# du /var/log/
0       /var/log/samba
12012   /var/log/httpd
0       /var/log/squid
0       /var/log/prelink
0       /var/log/vtund
0       /var/log/mail
0       /var/log/hotplug
0       /var/log/cups
0       /var/log/audit
0       /var/log/zebra
0       /var/log/ppp
12116   /var/log/

[root@~]# tail -1 /var/log/httpd/access_log 
192.168.116.1 - remote [04/Mar/2012:13:30:07 +0900] "GET /remote-hand/tmp/.di_read_data.json HTTP/1.1" 200 145 "http://192.168.116.148/remote-hand/sh_int.html?1330835245794" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11" 

 一アクセス277byte 
[root@~]# tail -1 /var/log/httpd/access_log |wc -c
277

計算上は一日で 
[root@~]# echo $((277*3600*24))
23932800
一アクセス277byteなので
277byte×3600秒×24時間= 23,932,800byteにもなる
PepoLinuxはメモリファイルシステムなのでこれじゃ直ぐに一杯になり動けくなる
取り合えず、apacheのログローティトを4時間毎に単独で回すことにした
[root@~]# crontab -l
#0-59/5 * * * *  /etc/mrtg.sh
#0-59/5 * * * *  /usr/bin/webalizer -c /etc/webalizer.conf
00 0-23/4 * * * /usr/sbin/ntpdate gpsntp.miz.nao.ac.jp
02 0-23/4 * * * /usr/sbin/logrotate /etc/logrotate.d/httpd

それとlogrotateの設定ファイルを書き換え
[root@~]# cat /etc/logrotate.d/httpd

var/log/httpd/*log {
    daily
    rotate 1
    missingok
    notifempty
    sharedscripts
    ifempty
    size 1M
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

[root@~]# logrotate -dv /etc/logrotate.d/httpd
reading config file /etc/logrotate.d/httpd
reading config info for /var/log/httpd/*log
Handling 1 logs
rotating pattern: /var/log/httpd/*log  1048576 bytes (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/httpd/access_log
  log does not need rotating
considering log /var/log/httpd/error_log
  log does not need rotating
considering log /var/log/httpd/ssl_access_log
  log does not need rotating
considering log /var/log/httpd/ssl_error_log
  log does not need rotating
considering log /var/log/httpd/ssl_request_log
  log does not need rotating
not running postrotate script, since no logs were rotated

これでしばらく様子を見る事に

pepo