logstash-plugins / logstash-output-slack

39 stars 15 forks source link

Slack output breaks when there are linebreaks in the attachments' fields #13

Open ryudice opened 6 years ago

ryudice commented 6 years ago

Config file


    slack {
            url =>"https://something"
            username => "slack-output-test"
            format => "%{[docker][labels][io_rancher_project_name]} "
            attachments => [
                {
                    color =>  "good"
                    pretext => "%{message}"
                    fields => [
                        { rancher_stack => "%{[docker][labels][io_rancher_project_name]}" }
                    ]
                }

            ]
        }

Sample data

Any thing that contains a linebreak in the message field breaks it.

Error from logstash log

 An unexpected error occurred! {:error=>#<JSON::ParserError: unexpected token at '{"color":"good","pretext":"System.ArgumentException: Requested value 'chabelosite' was not found.
8/27/2018 1:18:28 PM   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
8/27/2018 1:18:28 PM   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
8/27/2018 1:18:28 PM   at Saongroup.TechIntegration.Common.MVC.SiteRequestModelBinder.GetRequestType(String site, Type baseRequestType)
8/27/2018 1:18:28 PM   at Saongroup.TechIntegration.Common.MVC.SiteRequestModelBinder.BindModelAsync(ModelBindingContext bindingContext)
8/27/2018 1:18:28 PM   at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value)
8/27/2018 1:18:28 PM   at Microsoft.AspNetCore.Mvc.Internal.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
8/27/2018 1:18:28 PM--- End of stack trace from previous location where exception was thrown ---
8/27/2018 1:18:28 PM   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
8/27/2018 1:18:28 PM   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()","fields":[{"rancher_stack":"gdpr-rtbf-deploy-dev"}]}'>
simonare commented 5 years ago

I am also getting same error. Any solution for this error? I