2016-09-29 4 views
0

내가 돼지이 ELB 로그를 분석하려고 로그 분석하고 나는 성공적으로이 스크립트돼지 스크립트는 AWS는 ELB

사용하여 분석 할 수 있어요 +++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ + + + + + + + + + 2016-07-16T00 : 00 : 41.700161Z testelb 11.11.17.2:50883 192.168.1.94:80 0.00002 0.001392 0.000019 200 200 0 43 "GET http://test.example.com:80/bac?aid=b5cf542d74&cid=etrsewtp&bid=23c45c543&dte=Sat%20Jul%2016%202016%2008:00:41%20GMT+0800%20(HKT) HTTP/1.1" "Mozilla/5.0 아이폰, CPU 아이폰 OS 9_3_2 같은 맥 OS X) AppleWebKit/601.1.46 게코 같은 (KHTML) 모바일/13F69 "- - +++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ ++

*************************************************************** 
A = LOAD '/tmp/one.log' USING TextLoader AS (line:chararray); 

B = FOREACH A GENERATE FLATTEN (
    REGEX_EXTRACT_ALL(
      line,'^(\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) (\\S+) "(.+?)" "(.+?)" (\\S+) (\\S+)') 
    ) AS (
    timestamp:chararray, elb:int, client_port:chararray, backend_port:chararray, request_processing_time:float, backend_processing_time:float, response_processing_time:float, elb_status_code:int, backend_status_code:int, received_bytes:int, sent_bytes:int, request:chararray, user_agent:chararray, ssl_cipher:chararray, ssl_protocol:chararray 
); 

DUMP B; 

이제 url, aid, bid, cid 등의 요청을 추출하고 싶지만 정규 표현식과 일치 할 수는 없습니다. 누군가가이 정보를 얻을하는 데 도움이 수 있습니까?

위의 정규식 방법 외에도 전체 엘브 로그 정보를 얻는 다른 방법이 있다면 알고 싶습니다.

참고 : 지원, 입찰 및 cid 위치는 요청 로그에 고정되어 있지 않습니다.

답변