2017-03-13 12 views
0
My logstash configuration is giving me this error: 

내가이 명령을 실행 할 때마다 :/옵션/logstash/빈/logstash -f /etc/logstash/conf.d/logstash.conf --auto 리로드 --debugLogstash grok 수 오류

reason=>"Expected one of #, {, ,, ] at line 27, column 95 (byte 677) after filter {\n\n\tif [type] == \"s3\" {\n\t\tgrok {\n\t\n \t\t\tmatch => [\"message\", \"%{IP:client} %{USERNAME} %{USERNAME} \\[%{HTTPDATE:timestamp}\\] (?:\"", :level=>:error, :file=>"logstash/agent.rb", :line=>"430", :method=>"create_pipeline"} 

이것은 내 패턴과 관련이 있습니다.하지만 Grok 온라인 디버거에서 같은 것을 확인해 보면 대답이 필요합니다. 도움을 청하십시오.

Here is my logstash configuration: 

input { 
    s3 { 
     access_key_id => "" 
     bucket => "" 
     region => "" 
     secret_access_key => "" 
     prefix => "access" 
     type => "s3" 
     add_field => { source => gzfiles } 
     sincedb_path => "/dev/null" 
     #path => "/home/shubham/logstash.json" 
     #temporary_directory => "/home/shubham/S3_temp/" 

     backup_add_prefix => "logstash-backup" 
     backup_to_bucket => "logstash-nginx-overcart" 


} 

} 

filter { 

     if [type] == "s3" { 
       grok { 

         match => ["message", "%{IP:client} %{USERNAME} %{USERNAME} \[%{HTTPDATE:timestamp}\] (?:"%{WORD:request} 
     %{URIPATHPARAM:path} HTTP/%{NUMBER:version}" %{NUMBER:reponse} %{NUMBER:bytes} "%{USERNAME}" %{GREEDYDATA:responseMessage})"] 
     } 
     } 
     } 

output { 
    elasticsearch { 
    hosts => '' 
    index => "accesslogs" 
} 
    } 

답변

0

당신은 작동합니다 여행까지 파서를. 당신이 \ 가진 사람들을 탈출하는 경우 (예를 들어, 사용자 이름 VAR의 주위에) 당신의 경기 할당에 이스케이프 "문자의 몇 가지있다.

+0

별개의 패턴 파일을 만들었습니다. 지금 작동 중입니다. 로그 시간이 kibana에 문자열로 표시됩니다. 패턴 : NGINXACCESS % {IP : 클라이언트} % {사용자 이름} % [사용자 이름} \ [% {HTTPDATE {% {NUMBER : reponse : int} % {NUMBER : 바이트} "% {USERNAME} : {{{URL} {요청 URL} } "% {GREEDYDATA : responseMessage}) logstashconf : 필터 { 날짜 { 매치 => [ "log_timestamp", "일/MMM/YYYY : HH : MM : SS Z"]} –