2010-02-09 5 views
18

원시 액세스 로그를 appcfg.py와 함께 다운로드 할 수 있다는 것을 알고 있지만 파이썬 로깅 문, 예외 및 API 통계와 같은 특정 요청과 관련된 모든 정보에 관심이 있습니다. 온라인 로그 뷰어). 그 정보를 다른 방법으로 얻는 방법이 있다면 누구나 알 수 있습니까?AppEngine에서 로그 다운로드 Python 로그 문 포함

궁금한 점이 있다면 문제에 대한 통계 분석을하고 벽면의 대형 스크린에 표시하는 것입니다.

답변

21

물론 - 단지 appcfg.py하는 --severity 플래그를 전달합니다

$ appcfg.py help request_logs 
Usage: appcfg.py [options] request_logs <directory> <output_file> 

Write request logs in Apache common log format. 

The 'request_logs' command exports the request logs from your application 
to a file. It will write Apache common log format records ordered 
chronologically. If output file is '-' stdout will be written. 

Options: 
    -h, --help   Show the help message and exit. 
    -q, --quiet   Print errors only. 
    -v, --verbose   Print info level logs. 
    --noisy    Print all logs. 
    -s SERVER, --server=SERVER 
         The server to connect to. 
    --insecure   Use HTTP when communicating with the server. 
    -e EMAIL, --email=EMAIL 
         The username to use. Will prompt if omitted. 
    -H HOST, --host=HOST Overrides the Host header sent with all RPCs. 
    --no_cookies   Do not save authentication cookies to local disk. 
    --passin    Read the login password from stdin. 
    -A APP_ID, --application=APP_ID 
         Override application from app.yaml file. 
    -V VERSION, --version=VERSION 
         Override (major) version from app.yaml file. 
    -n NUM_DAYS, --num_days=NUM_DAYS 
         Number of days worth of log data to get. The cut-off 
         point is midnight UTC. Use 0 to get all available 
         logs. Default is 1, unless --append is also given; 
         then the default is 0. 
    -a, --append   Append to existing file. 
    --severity=SEVERITY Severity of app-level log messages to get. The range 
         is 0 (DEBUG) through 4 (CRITICAL). If omitted, only 
         request logs are returned. 
    --vhost=VHOST   The virtual host of log messages to get. If omitted, 
         all log messages are returned. 
    --include_vhost  Include virtual host in log messages. 
    --end_date=END_DATE End date (as YYYY-MM-DD) of period for log data. 
         Defaults to today. 
+0

을 어떻게 할 수 여기에

은에서 appengine 자체에서 실행되는 응용 프로그램입니다 그것을 놓쳤습니다 :-( –

15

이 정말 잘 우리를 위해 작동하는 것입니다 : 어쨌든

appcfg.py --append --num_days=0 --include_all request_logs /path/to/your/app/ /var/log/gae/yourapp.log 

라인 위 얻을 것이다 귀하의 모든 로그 레코드를 작성한 후 로그 파일에 추가하십시오. 그렇지 않은 경우, 새 로그 파일을 작성합니다. 실제로는 기존 로그를보고 (있을 경우) 중복을 얻지 않습니다. 원하는 경우 --append없이 실행할 수 있지만 로그 다운로드를 자동화하는 경우 사용하십시오.

여기 키는 문서화되지 않은 것으로 보이는 --include_all 플래그입니다. 이 플래그는 GAE의 웹 로그 뷰어를 사용하는 경우 표시되는 모든 데이터를 가져옵니다. 따라서 다음과 같은 필드를 얻을 수 있습니다. ms = 71 cpu_ms = 32 api_cpu_ms = 12 cpm_usd = 0.000921 ...

좋아, 나는 누군가를 돕기를 바랍니다.

BTW, 우리는이에 블로그 게시물을 썼다 여기에 체크 아웃 : http://bit.ly/GAE-LOGS

+0

충분히 감사 할 수 없습니다! 내 응용 프로그램은 90 일간 보존 한계에 빠르게 다가 섰고 이제는 모든 로그를 저장할 생각이 전혀 없었습니다. 그 중 일부는 물론입니다. 지금은 알았습니다!) – lenik

+0

' --include-all' 플래그는 OP에서 언급 한 파이썬'logging' 출력을 얻지 못하는 것 같습니다. 어쩌면 그것은 사용하지만, 더 이상은 아닙니다. 그러나, @nick 존슨의 팁은 '- 심각도'플래그를 사용하는 것이 트릭을 수행하는 것 같습니다! – hamx0r

3

나는 appcfg와 100M 한계로 실행 것으로 보인다. 당신이 처리를 촉진 할 수 있도록 사용자 정의 (또한 나를 request_logs에 대한 분석의 모든 데이터를 다운로드되지 않고 원시 로그에 액세스 할 수있는 방법을 여기에 https://github.com/manasg/gae-log-fetcher