Hi there,
I'm ingesting AWS WAF logs and it works fine for a few minutes but then stops with the following error:
response=>{"index"=>{"_index"=>"waf-logs-2023.08.01", "_id"=>"rjCKGYoBsxYs-jwL007l",
"status"=>400, "error"=>{"type"=>"document_parsing_exception",
"reason"=>"[1:6817] failed to parse: Limit of total fields [1000] has been
exceeded while adding new fields [1]",
"caused_by"=>{"type"=>"illegal_argument_exception",
"reason"=>"Limit of total fields [1000] has been exceeded while adding
new fields [1]"}}}}}
If I go into the Dev Console and increase the number of fields limit, it starts ingesting again but that will also eventually fail against whatever higher number was passed or it rolls to the next day's index:
PUT waf-logs-2023.08.01/_settings
{
"index.mapping.total_fields.limit": 4000
}
Here's my logstash config:
input {
s3 {
"access_key_id" => "x"
"secret_access_key" => "x"
"region" => "us-east-1"
"bucket" => "mybucket"
"type" => "waf-log"
"interval" => "300"
"sincedb_path" => "/tmp/.waf-log_since.db"
"prefix" => "mybucket/2023/08"
}
}
filter {
if [type] == "waf-log" {
json {
source => "message"
}
date {
match => [ "[timestamp]", "UNIX_MS" ]
}
geoip {
source => [ "[httpRequest][clientIp]" ]
target => geoip
}
ruby {
code => '
event.get("[httpRequest][headers]").each { |kv|
event.set(name = kv["name"], value = kv["value"])}
'
}
}
}
output {
elasticsearch {
hosts => ["http://127.0.0.1:9200/"]
index => "waf-logs-%{+YYYY.MM.dd}"
}
}
What is the best approach to handle this?
Thank you!