カフカに送られたfilebeat nginxのログを使用します

1.配置filebeat_nginx.yml

filebeat.modules:
-モジュール:nginxの
  アクセス:
    有効:真
    var.paths:[ "/var/log/nginx/access.log*"] 
  エラー:
    有効:真
    var.paths:[ "は/ var / log / nginxの/ error.logに* "] 

#----------------------------------カフカ出力------- -------------------------#
output.kafka:
  バージョン: "1.0.1" 
  有効:真
  ホスト:[ 'XXX:9092'、 ' XXX:9092' 、 'XXX:9092'] 
  トピック: 'TEMP' 
  required_acks:1 #DEFAULTの
  圧縮:GZIP #DEFAULT 
  max_message_bytes:1000000 #DEFAULT 
  codec.format:
    文字列: '%{[メッセージ]}

2. [スタート] filebeat

./filebeat -e -c filebeat_nginx.yml

3.アクセスnginxの

尾-f /var/log/nginx/access.log

ファイルのログ出力

{ "TS": "2019年10月14日10時53分22秒"、 "ホスト": "127.0.0.1"、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "localhost"を、 "XFF": " - " 、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日10時53分23秒"、 "ホスト": "127.0.0.1"、 "たClientIP":」 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを""ドメイン":"ローカルホスト" "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日10時53分23秒"、"ホスト":" 127.0.0.1" 、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST" : "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "ローカルホスト"、 "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"}たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }
{ "TS": "2019年10月14日午前10時53分30秒"、 "ホスト": "127.0.0.1"、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "localhost"を、 "XFF": " - " 、 "リファラー": " - "、 "ステータス": "304"} ドメイン":"ローカルホスト" "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日午前10時53分30秒"、"ホスト":" 127.0.0.1" 、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST" : "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "ローカルホスト"、 "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"}たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }
{ "TS": "2019年10月14日10時53分三十一秒"、 "ホスト": "127.0.0.1"、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL": "/ index.htmlを"、 "ドメイン": "localhost" を、 "XFF": " - " 、 "リファラー": " - "、 "ステータス": "304"}

カフカ出力

{ "TS": "2019年10月14日10時53分23秒"、 "ホスト": "127.0.0.1"、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "localhost"を、 "XFF": " - " 、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日10時53分23秒"、 "ホスト": "127.0.0.1"、 "たClientIP":」 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを""ドメイン":"ローカルホスト" "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日午前10時53分22秒"、"ホスト":" 127.0.0.1" 、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST" : "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "ローカルホスト"、 "XFF": " - "、 "リファラー": " - "、 "ステータス": "304"}たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }たClientIP ":" 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost" を、 "URL":」 /index.html","domain":"localhost","xff":"-","re​​ferer":"-","status":"304" }
{ "TS": "2019年10月14日午前10時53分30秒"、 "ホスト": "127.0.0.1"、 "たClientIP": "127.0.0.1"、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを"、 "ドメイン": "localhost"を、 "XFF": " - " 、 "リファラー": " - "、 "ステータス": "304"} 
、{ "TS": "2019年10月14日10時53分31秒"、 "ホスト": "127.0.0.1"、 "たClientIP":」 127.0.0.1" 、 "サイズ":0、 "RESPONSETIME":0.000、 "upstreamtime": " - "、 "upstreamhost": " - "、 "HTTP_HOST": "localhost"を、 "URL": "/ index.htmlを""ドメイン ":" localhost」を、 "XFF": " - "、 "リファラ": " - "、 "ステータス": "304"}

 

おすすめ

転載: www.cnblogs.com/tonglin0325/p/11670456.html