logstash mail to multiple recipients -
at logstash conf filter , assigned multiple email id variable(variable name = targetmailid) , output field , trying use variable. however, assiging multiple email id's cc field in output. please suggest.
filter { kv { field_split => "," value_split=>":" } if [ref_type] =~ /tag/ { ruby { code => "tag= event['ref'] targetmailid = 'testuser1@mail.com,testuser2@mail.com,testuser3@mail.com' } } } output { if "tagcreate" in [tags] { email { body => "test messgage" => "admin@emil.com" => "admin2@email.com" cc => "targetmailid" subject => "test mail" options => { smtpiporhost => "smtp" port => 25 } } }
you need use sprintf format %{...}
this:
email { body => "test messgage" => "admin@emil.com" => "admin2@email.com" cc => "%{targetmailid}" <--- modify subject => "test mail" options => { smtpiporhost => "smtp" port => 25 } }
update
also make sure modify following part:
if [ref_type] =~ /tag/ { ruby { code => "event['targetmailid'] = 'testuser1@mail.com,testuser2@mail.com,testuser3@mail.com'" } } else { mutate { add_field => { "targetmailid" => ""} } }
Comments
Post a Comment