'awstats'에 해당하는 글 2건

iframe awstats 삽입

Daily/Prog 2012. 6. 18. 14:10

관리자 모드 등 웹페이지에 iframe으로 awstats 삽입하기.
iframe 높이를 awstats 화면의 높이와 같게 하여 iframe 스크롤 감추기.
마우스 커서가 iframe 위에서 작동하지 않는 것을 임시레이어 생성으로 해결.

 

 

1. awstats 를 넣을 공간에 iframe 삽입

 

<iframe src="/awstats/awstats.pl?config=oops4u.com" width="100%" frameborder="0"></iframe>

 

 

2. 이중 스크롤을 없애기 위해 awstats 뷰페이지의 높이를 iframe 높이로 지정


(awstats 뷰페이지 역시 iframe을 사용하므로 구체적으로는 awstats 뷰페이지의 오른쪽 프레임 높이...)

 

<iframe src="/awstats/awstats.pl?config=oops4u.com" name="ifr_awstats" width="100%" frameborder="0" scrolling='no' onload="ifr_resize(this)"></iframe>


<script type="text/javascript">
function ifr_resize(e) {
    e.height = eval( e.name + ".frames['mainright'].document.body.scrollHeight" );
    //e.height = document.ifr_awstats.frames['mainright'].document.body.scrollHeight;
}
</script>


이렇게 하면 iframe이 로드되면서 iframe의 세로길이는 awstats의 세로길이와 같게 되므로 스크롤이 생기지 않음.
하지만 마우스 커서가 iframe인 파란 영역 위에 있을 때 바깥쪽 세로 스크롤이 작동하지 않음.

 

 

 

 

3. 임의의 레이어를 만들어 iframe 위에 겹치게 배치

<div id="scroll_container" style="width:95%; position:absolute;"></div>

 

<iframe src="/awstats/awstats.pl?config=oops4u.com" name="ifr_awstats" width="100%" frameborder='0' scrolling='no' onload="ifr_resize(this)"></iframe>

 

<script type="text/javascript">
function ifr_resize( e ) {
    e.height = eval( e.name + ".frames['mainright'].document.body.scrollHeight" );
    document.getElementById('scroll_container').style.height = e.height + 'px';
}
</script>

 

임의의 div 영역(빨강)을 만들어 iframe 영역(파랑)을 덮어씌우면,
마우스가 iframe 위에 있어도 div 위에 있는 것으로 인식하고 바깥쪽 세로 스크롤이 작동됨.

 

 


WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,

awstats

웹 로그 분석기 설치

다운로드 사이트 : http://www.awstats.org/

1. 다운로드 / 압축풀기


2. 디렉토리 이동 (구동될 디렉토리)

# mv awstats-6.95 awstats
# mv awstats /home/www/


3. 디렉토리 생성

# mkdir /etc/awstats
# mkdir /var/lib/awstats

 - 환경설정 파일, 데이터 파일이 저장될 디렉토리


4. 설치전 설정

* 로그 형식 지정 (common or combined)

# vi /usr/local/httpd-2.2.4/conf/httpd.conf
CustomLog logs/access_log combined

* 가상 호스트를 사용한다면 가상호스트에도 설정 확인

# vi /usr/local/httpd-2.2.4/conf/extra/httpd-vhost.conf
CustomLog logs/access_log combined

* 기존 로그 초기화

# cd /usr/local/httpd-2.2.4/logs/
# > oops4u.com-access_log


5. 설치 / 설정

# cd /home/www/awstats/tools/
#  ./awstats_configure.pl

Do you want to continue setup from this NON standard directory [yN] ? y
Config file path ('none' to skip web server setup):
> /usr/local/httpd-2.2.4/conf/httpd.conf           # 아파치 설정파일 경로 (설정 추가함)

Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y         # 설정파일 생성

Your web site, virtual server or profile name:
> oops4u.com                                       # 설정파일 이름

Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
> [enter]

-----> Create config file '/etc/awstats/awstats.oops4u.com.conf'
 Config file /etc/awstats/awstats.oops4u.com.conf created.

-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/home/www/awstats/wwwroot/cgi-bin/awstats.pl -update -config=oops4u.com
Or if you have several config files and prefer having only one command:
/home/www/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...

A SIMPLE config file has been created: /etc/awstats/awstats.oops4u.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'oops4u.com' with command:
> perl awstats.pl -update -config=oops4u.com
You can also read your statistics for 'oops4u.com' with URL:
> http://localhost/awstats/awstats.pl?config=oops4u.com


6. 설정 파일 변경

# vi /etc/awstats/awstats.oops4u.com.conf
LogFile="/usr/local/httpd-2.2.4/logs/oops4u.com-access_log"
Lang="ko"


7. 데이터베이스 생성 / 업데이트

# /home/www/awstats/wwwroot/cgi-bin/awstats.pl -update -config=oops4u.com
Create/Update database for config "/etc/awstats/awstats.oops4u.com.conf" by AWStats version 6.95 (build 1.943)
From data in log file "/usr/local/httpd-2.2.4/logs/oops4u.com-access_log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 2758
 Found 0 dropped records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 2758 new qualified records.


8. crontab 추가

# vi /etc/crontab
# awstats per 5 minutes
*/5 * * * * root perl /home/www/awstats/tools/awstats_updateall.pl now > /dev/null 2>&1


Troubleshooting

Error: Can't find AWStats program ('awstats.pl').
Use -awstatsprog option to solve this.

awstats_updateal.pl 실행시 나타나는 위의 오류는 awstats.pl 파일을 찾을 수 없다는 것이다.
파일에 경로를 지정해주면 된다.

# vi /home/www/awstats/tools/awstats_updateall.pl
# Run update process for each config file found
if (-s "$Awstats") { $AwstatsFound=1; }
elsif (-s "/home/www/awstats/wwwroot/cgi-bin/awstats.pl") {
    $Awstats="/home/www/awstats/wwwroot/cgi-bin/awstats.pl";
    $AwstatsFound=1;
}



GeoIP

국가별 IP 체크

다운로드 사이트 : http://www.maxmind.com

1. 데이터베이스 다운로드 / 설치

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
# gzip -d GeoIP.dat.gz
# mkdir /usr/local/share/GeoIP
# mv GeoIP.dat /usr/local/share/GeoIP/


2. API 다운로드 / 설치

라이브러리를 필요로 하지 않는 PurePerl 모듈 설치

# wget http://geolite.maxmind.com/download/geoip/api/pureperl/Geo-IP-PurePerl-1.24.tar.gz
# tar zxvf Geo-IP-PurePerl-1.24.tar.gz
# cd Geo-IP-PurePerl-1.24
# perl Makefile.PL
# make
# make install


3. Awstats 연동

# vi /etc/awstats/awstats.oops4u.com.conf
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"


4. 작동 확인

http://mydomain/awstats/awstats.pl?config=mynames


WRITTEN BY
손가락귀신
정신 못차리면, 벌 받는다.

,