2017-06-23 34 views
0

我想使用Logstash - 斯莱克插件使用此配置:Logstash - 斯莱克插件配置问题

slack { 
    url => "..." 
    channel => ["..."] 
    attachments => [ {"color" => "#36a64f"},{"title" => "This is a title %{title}"},{"author_name" => %{name}} ] 
} 

但是,当我收到一个邮件和附件,不设置颜色正确和变量的值titlename显示为%{title}%{name}

有没有人成功配置过这个插件?什么应该是适当的设置?

+0

你能解决这个问题。我也面临同样的问题。谢谢。 – pradeepchhetri

回答

0

我神交过滤器是这样的:

grok { 
     match => ["message", "%{TIMESTAMP_ISO8601} Thread:'(?<thread>[^']+)' Level:'%{LOGLEVEL:log-level}' Message:%{GREEDYDATA:information}"] 

,我能够通过在邮件中使用这个来解决这个问题:

slack 
     { 
      url => "https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
      format => "%{log-level} at %{@timestamp} on %{type} \n\n Message: %{information}" 
     } 

注:附件仍然不工作也的\ n \ n

我的错误消息记录了一个多行大块文本,所以我真的想做这样的事情,这是offcourse不工作:

slack 
     { 
      url => "https://hooks.slack.com/services/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" 
      format => "%{log-level} at %{@timestamp} on %{type} with IP:%{host}" 
      attachments => "Message: %{information}" 
     }