2016-10-12 3 views
0

저는 rsyslog 및 kafka에 익숙하며 다음 로그 스트림을 얻으려고 할 때 약간의 문제가 있습니다. 여기 rsyslog가 kafka에 로그를 쓰지 않습니다.

nginx log -> rsyslog-imudp -> rsyslog-omkafka -> kafka 

나는 그것이이다

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic rsyslog_logstash --from-beginning 

어쩌면 소비자 터미널에서 모든 출력이없는 불길

module(load="imudp") 
input(type="imudp" port="514") 

module(load="omkafka") 

template(name="nginxLog" type="string" string="%msg%") 

if $inputname == "imudp"then { 
     action(type="omkafka" 
      template="nginxLog" 
      broker=["localhost:9092"] 
      topic="rsyslog_logstash" 
      partitions.auto="on" 
      confParam=[ 
       "socket.keepalive.enable=true" 
      ] 
     ) 
} 

의 nginx conf의

log_format jsonlog '{' 
    '"host": "$host",' 
    '"server_addr": "$server_addr",' 
    '"http_x_forwarded_for":"$http_x_forwarded_for",' 
    '"remote_addr":"$remote_addr",' 
    '"time_local":"$time_local",' 
    '"request_method":"$request_method",' 
    '"request_uri":"$request_uri",' 
    '"status":$status,' 
    '"body_bytes_sent":$body_bytes_sent,' 
    '"http_referer":"$http_referer",' 
    '"http_user_agent":"$http_user_agent",' 
    '"upstream_addr":"$upstream_addr",' 
    '"upstream_status":"$upstream_status",' 
    '"upstream_response_time":"$upstream_response_time",' 
    '"request_time":$request_time' 
'}'; 

access_log syslog:server=server_ip,facility=local7,tag=nginx_access_log jsonlog; 

그리고 위해 rsyslog의 conf입니다 템플릿을 찾았지만 m을 찾을 수 없습니다. 그것에 관한 uch 문서.

답변

0

imsp를받은 메시지 수와 omkafka로 보낸 메시지 수를 확인하는 rsyslog-impstats 모듈을 사용하십시오.

+0

귀하의 의견에 감사드립니다. 유용한 로그가 있습니다. '/etc/init.d/rsyslog start' 명령을 사용하면 omkafka에 어떤 스트림도 보내지 않고'rsyslogd' 명령은 예상대로 잘 작동합니다. 이 로그를 가지고 있지 않은 첫 번째 메시지는 다음과 같습니다. Thu Oct 13 09:45:09 2016 : omkafka : 제출 = 6 maxoutqsize = 3 실패 = 0 topicdynacache.skipped = 0 topicdynacache.miss = 0 topicdynacache.evicted = 0' – Luffy

+0

작업에 queue.name을 추가하고 특수 대기열 통계를 확인하여 rsyslog가 msg를 대기열로 보낼지 여부를 결정할 수 있습니다. – chenryn

관련 문제