2017-06-23 37 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}" 
     }