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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -