This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ACCESS_LOG | awk '$4 >= "[29/Jan/2012:12:00:00" && $4 < "[29/Jan/2012:13:00:00"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## SET ENV "UA" ## | |
### DEFAULT | |
RewriteRule .* - [E=UA:default] | |
### PC | |
RewriteCond %{HTTP_USER_AGENT} Windows [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} Mac\sOS\sX [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} Macintosh [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} Mac_ [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} Linux [NC,OR] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ find ./20120831_testdir -type f -print0 | xargs -0 stat --format='%a %N' | sed -e "s/[\`']//g" | |
755 ./20120831_testdir/2009032/httpdconf.pl | |
777 ./20120831_testdir/showmod.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------------------------------------------------------- | |
# Urchin Logformat Map - Custom Format | |
# | |
# Urchin uses this file to determine which fields are contained in the log file. | |
# The file contains name/value pairs which affect the parsing of the data fields. | |
# The log file can contain lines with up to two different formats which are | |
# denoted as Primary and Secondary in the name/value pairs below. | |
# | |
# Lines beginning with a '#' are ignored. Fields in this file are separated by | |
# whitespace (spaces or tabs). Any fields that have whitespace in them must be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ACCESS_lOG | awk '{bytes = bytes + $10} END {print bytes/1048576}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Rx | |
$ LANG=C sudo sar -n DEV | grep eth0 | grep -v Average | awk '{print $1, $5*8/1048576}' | |
## Tx | |
$ LANG=C sudo sar -n DEV | grep eth0 | grep -v Average | awk '{print $1, $6*8/1048576}' | |
# Ex. | |
$ LANG=C sudo sar -n DEV -f /var/log/sa/sa24 | grep eth0 | grep -v Average | awk '{print $1, $6*8/1048576}' | |
... | |
23:20:01 4.32473 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LANG=C | |
/bin/gawk -F"\t" '$0 !~ /^#/ { | |
## make epochtime from timestamp | |
split($1, d, "-"); | |
split($2, t, ":"); | |
timestamp=d[1]" "d[2]" "d[3]" "t[1]" "t[2]" "t[3]; | |
epochtime=mktime(timestamp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExpiresActive On | |
ExpiresDefault A0 | |
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform" | |
Header set Pragma "no-cache" | |
ErrorDocument 503 /maintenance/index.html | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} !^/maintenance/.*$ | |
RewriteRule ^.*$ - [R=503,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
### | |
### ApacheのCombined + %D 形式のアクセスログから1秒毎の同時接続数を集計するスクリプト。 | |
### タイムスタンプを接続が開始された時刻とみなして、%D の間は接続が維持されているものとする。 | |
### 結果はあくまで参考値。 | |
### スクリプトと同じディレクトリに access_log をおいてから実行する。 | |
### | |
use strict; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
TODAY=`date +%Y%m%d` | |
if [ $# -eq 1 ] | |
then | |
TARGET_DATE=$1 | |
else | |
TARGET_DATE=`date -d "1 day ago" +%Y%m%d` |
OlderNewer