logstashログファイルは言う:フィールドタイプが以前と同じで変更されていないときに、Log-stashの解析に失敗したのはなぜですか?
"tags"=>["_grokparsefailure"]}, "status_code"]}>, @data={"@version"=>"1", "@timestamp"=>"2016-09-24T08:00:54.894Z", "path"=>"/var/log/nginx/access.log", "host"=>"sample-com", "remote_addr"=>"127.0.0.1", "remote_user"=>"-", "date"=>"05/Sep/2016:10:03:01 +0000", "method"=>"GET", "uri_path"=>"/accounts", "version"=>"HTTP/1.1", "status_code"=>"200", "body_byte_sent"=>419, "referer"=>"-", "user_agent"=>"python-requests/2.4.3 CPython/2.7.9 Linux/3.16.0-4-amd64", "request_time"=>6.161, "auth_type"=>"Bearer", "client_id"=>"beta",
"web_client_ip"=>"172.*.131.177", "response_json"=>{"_links"=>{"applications"=>{"href"=>"/applications"}, "menus"=>{"href"=>"/menus"}, "messages"=>{"href"=>"/messages"}, "numbers"=>{"href"=>"/numbers"}, "self"=>{"href"=>"/accounts"}}, "account_status"=>"active", "creation_date"=>"2016-06-07 09:25:18", "credit"=>{"balance"=>#<BigDecimal:367dbf49,'0.19819267E4',8(12)>, "currency"=>"usd"}, "email"=>"*@gmail.com",
"id"=>"677756yt7557", "lastname"=>"Qurbani", "name"=>"M", "notifications"=>{"black_list"=>{"uids"=>[]}, "settings"=>{"email"=>{"low_credit"=>true, "new_feature"=>true, "receive_f"=>true, "send_f"=>true, "voice"=>true}, "language"=>"en", "push_notif"=>{"low_credit"=>true, "new_feature"=>true, "receive_f"=>true, "send_f"=>true, "voice"=>true}, "sms"=>{"low_credit"=>true, "new_feature"=>true, "receive_f"=>true, "send_f"=>true, "voice"=>true}}}, "phone"=>"+9****", "status"=>"inactive", "verification_status"=>{"email"=>"unverified", "phone"=>"verified"}}, "request_json"=>{}, "tags"=>["_grokparsefailure"]}, @metadata_accessors=#<LogStash::Util::Accessors:0x6ec6acbe @store={"path"=>"/var/log/nginx/access.log"}, @lut={"[path]"=>[{"path"=>"/var/log/nginx/access.log"}, "path"]}>,
@cancelled=false>], :response=>{"create"=>{"_index"=>"logstash-api-2016.09.24", "_type"=>"logs", "_id"=>"AVdbNisZCijYhuqEamFy", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse [response_json.credit]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"unknown property [balance]"}}}}, :level=>:warn}
ここで私はクレジットセクションで、以下のようなログを持っている:
"credit": {"balance": 0.0, "currency": "usd"}
私はElasticsearchからすべてのインデックスを削除している、と私はどの.sincedb*
が見つかりませんでしたhome
または他の場所でlogstash
DBを削除してください。
実際にbalance
の値に変更がない場合にこのエラーが発生するのはなぜですか?その理由は何ですか?
- 再起動後、
Logstash
ログファイルのデータは集計されません。
私は/var/lib/logstash/
からすべてのsince_dbs_*
を削除し、Logstash
構成の最初の位置からテーリング開始すると述べました。
は今、以下のエラーが発生します
object mapping for [response_json.credit] tried to parse field [credit] as object, but found a concrete value
時々クレジットが、時には2つのフィールドを持つオブジェクトとしてスカラー値として送信されているようです!
EDIT1:異なるデータと
2別のクレジットフィールドはElasticsearchに1つのクレジットに掲載されています。だから私は、これらのフィールドの名前を変更し、logstashで両方のconfigsからの信用を削除しようとしたので、今の私がありますので、エラーが再び起こる
add_field => {"first_credit" => "%{[response_json.credit]}"}
remove_field => ["response_json.credit"]
新しいフィールドが追加されますが、値は文字通り%{[response_json.credit]}
で、フィールドが削除されません。私は信用の価値を得て、それを最初の信用の中に入れ、信用そのものを取り除きたいと思う。私も以下を試しました:
add_field => {"first_credit" => "%{[response_json][credit]}"}
remove_field => ["response_json.credit"]
私は間違っていますか?
EDIT:2
私は1つのファイルaccess.log
が異なる値でcredit
フィールドを持っていることに気づきました。 credit
credit
は、数値です。は、数値です。
credit
は、JSON:{"currency": "usd"、 "balance":2です。99}
を私は問題を解決し、ES
にstring
としてそれらすべてを保存するには、以下のlogstashコンフィギュレーションを使用:
if ([response_json][credit]) {
mutate {
add_field => {"new_credit" => "%{[response_json][credit]}"}
remove_field => [ "[response_json][credit]" ]
}
}
それは以下のエラー与える:あなたを見てから
"new_credit"=>"{\"balance\":3.102,\"currency\":\"usd\"}", "tags"=>["_grokparsefailure"]},
@metadata_accessors=#<LogStash::Util::Accessors:0x46761362 @store={"path"=>"/var/log/nginx/access.log.1"},
@lut={"[path]"=>[{"path"=>"/var/log/nginx/access.log.1"}, "path"]}>,
@cancelled=false>], :response=>{"create"=>{"_index"=>"logstash-api-2016.09.27", "_type"=>"logs", "_id"=>"AVdqrION3CJVjhZgZcnl", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse [new_credit]", "caused_by"=>{"type"=>"number_format_exception", "reason"=>"For input string: \"{\"balance\":3.102,\"currency\":\"usd\"}\""}}}}, :level=>:warn
設定は何ですか? – alpert
Elasticsearchにインデックスマッピングを投稿できますか? :9200/logstash-api-2016.09.24/_mapping – fylie
これは大きなマッピングです。私はクレジットに関するセクションをコメントしました。 – ALH