
하나의 가상 호스트를 필터링하기 위해 파이프를 통해 icecast 로그를 읽을 때 AWStats 7.2 cron 작업(Ubuntu 14.04에서 재고 awstats 패키지 사용)에서 이 오류가 발생합니다.
Error while processing /etc/awstats/awstats.mysite.conf
Create/Update database for config "/etc/awstats/awstats.mysite.conf" by AWStats version 7.2 (build 1.992)
From data in log file "grep '\/mysite' < /var/log/icecast2/access.log |"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Error: Command for pipe 'grep '\/mysite' < /var/log/icecast2/access.log |' failed
Setup ('/etc/awstats/awstats.mysite.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
액면 그대로 이는 단순한 권한 문제처럼 보이지만 www-data
이를 실행하는 사용자는 구성 파일과 로그 파일을 모두 읽을 수 있습니다. 해당 사용자 계정에 로그인하면 문제 없이 두 파일을 모두 읽을 수 있습니다.
#sudo -u www-data ls -al /etc/awstats/awstats.mysite.conf /var/log/icecast2/access.log
-rw-r--r-- 1 www-data www-data 444 May 13 11:23 /etc/awstats/awstats.mysite.conf
-rw-r--r-- 1 icecast2 icecast 0 Jun 8 05:29 /var/log/icecast2/access.log
동일한 사용자로 grep 명령을 실행하면 제대로 작동합니다.
허위 문제를 피하기 위해 모든 플러그인을 비활성화했습니다. 어쨌든 저는 geoip만 사용하고 있으므로 설정은 매우 평범합니다. 전체 출력으로 awstats 명령을 수동으로 실행하면 --debug=6
파일을 읽는 데 문제가 없는 것처럼 보입니다. 파일을 닫을 때 오류가 발생합니다. 공교롭게도 이 로그 파일은 현재 비어 있으므로 분석할 내용이 없습니다. 하지만 확실히 권한 오류가 생성되어서는 안 될까요?
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Start Update process (lastprocesseddate=201505)
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Open log file "grep '\/mysite' < /var/log/icecast2/access.log |"
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Sat Jun 13 20:33:21 2015 - DEBUG 1 - _host_p:0 _host_h:0 _host_k:0 _host_l:0 _host_s:0 _host_u:0
Sat Jun 13 20:33:21 2015 - DEBUG 1 - _url_p:0 _url_k:0 _url_e:0 _url_x:0
Sat Jun 13 20:33:21 2015 - DEBUG 1 - _waithost_e:0 _waithost_l:0 _waithost_s:0 _waithost_u:0
Sat Jun 13 20:33:21 2015 - DEBUG 1 - End of processing log file (AWStats memory cache is TmpDNSLookup=0 TmpBrowser=0 TmpOS=0 T
mpRefererServer=0 TmpRobot=0)
....(lots of stuff that seems related to successful processing and output deleted)
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Update offset of section sider_404=10022 in file at offset 1381
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Update MonthVisits=290 in file at offset 2140
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Update MonthUnique=168 in file at offset 2173
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Update MonthHostsKnown=0 in file at offset 2210
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Update MonthHostsUnknown=182 in file at offset 2249
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Call to Init_HashArray
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Close log file "grep '\/mysite' < /var/log/icecast2/access.log |"
Sat Jun 13 20:33:21 2015 - DEBUG 1 - Command for pipe 'grep '\/mysite' < /var/log/icecast2/access.log |' failed
내가 무엇을 놓쳤나요?