2014-04-15 2 views
0

Piwik을 설치하여 잘 작동하지만 Nginx가 로그를 직접 가져 오도록 구성하여 로그 파일을 구문 분석하지 못하게합니다.Nginx 로그를 Piwik에서 직접 가져 오기 설정합니다.

# Log to piwik as well 
CustomLog "|/path/to/import_logs.py --option1 --option2 ... -" myLogFormat 

하지만 난 Nginx에에 이런 일을 찾을 수 없습니다 :

나는이 다음을 사용하여 아파치에서 수행 할 수 있습니다 알고 있습니다.

누구에게이 방법을 알고 있습니까?

답변

1

Nginx에서는 불가능합니다. this post in the mailing list을 참조하십시오.

아니요, nginx는 simlpy CPU 낭비이므로 파이프 로깅을 지원하지 않습니다. tail -F/path/to/log |를 시도 할 수 있습니다. app 이것은 파이프 로그와 동일한 CPU 낭비가 거의 입니다.

그것은이 느린 이유를 알고 싶다면 :

Logging to pipe is a CPU waste because it causes a lot of context switches 
and memory copies for every log operation: 

1) nginx writes to a pipe, 
2) context switch to script, 
2) script reads from the pipe, 
3) script processes line, 
4) script writes to a database, 
5) context switch to nginx. 

instead of single memory copy operation to a log file. 

실행하고 Piwik에 데이터를 배관, 로그 파일 붙었다 다른 스크립트를 작성해야합니다.

관련 문제