[2024-04-13T13:11:05,050][ERROR][logstash.outputs.opensearch][main][f07d574eba8e9bf8cf56e3e76bd091de1fadf988ff2f6edda9713b5a1dcdd0ac] Could not index event to OpenSearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"syslog_log-{"ip":"10.1.29.43"}-2024.04.13", :routing=>nil}, {"service"=>{"type"=>"system"}, "message"=>"[2024-04-13 13:11:04] INFO: This is an example testing message from Python code using syslog in Logstash", "log_type"=>"syslog", "@version"=>"1", "event"=>{"original"=>nil}, "host"=>{"ip"=>"10.1.29.43"}, "tags"=>["_grokparsefailure_sysloginput", "_jsonparsefailure", "_grokparsefailure"], "log"=>{"syslog"=>{"facility"=>{"name"=>"kernel", "code"=>0}, "priority"=>0, "severity"=>{"name"=>"Emergency", "code"=>0}}}, "index_name"=>"syslog_log-{"ip":"10.1.29.43"}", "@timestamp"=>2024-04-13T13:11:04.779830728Z}], :response=>{"index"=>{"_index"=>"syslog_log-{"ip":"10.1.29.43"}-2024.04.13", "_id"=>nil, "status"=>400, "error"=>{"type"=>"invalid_index_name_exception", "reason"=>"Invalid index name [syslog_log-{"ip":"10.1.29.43"}-2024.04.13], must not contain the following characters [ , ", *, \, <, |, ,, >, /, ?]", "index"=>"syslog_log-{"ip":"10.1.29.43"}-2024.04.13", "index_uuid"=>"na"}}}}
getting this error with
syslog {
port => 9111
syslog_field => "syslog"
grok_pattern => "<%{POSINT:priority}>%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:host} %{DATA:loglevel}: %{GREEDYDATA:message}"
add_field => { "log_type" => "syslog" } # Add log_type field to syslog messages
filter {
if [log_type] == "syslog" {
json {
source => "message"
}
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:host} %{DATA:loglevel}: %{GREEDYDATA:message}" }
}
mutate {
add_field => { "index_name" => "syslog_logs-%{host}" } # Set the index name for syslog field
}
}