logstash-plugins / logstash-output-gelf

Apache License 2.0
15 stars 18 forks source link

Allow full_message optional field in GELF specification to not be sent #13

Closed nahun closed 3 years ago

nahun commented 8 years ago

In the GELF specs, the "full_message" field is optional, but the plugin always sends the field in the output. I'd like to not send the field as it just takes up space and I don't have a need for it yet.

This diff on 2.0.2 worked for me, but I don't know ruby at all really...

--- gelf.rb.bak 2016-01-25 11:07:32.463539274 -0800
+++ gelf.rb     2016-01-25 10:54:57.875515810 -0800
@@ -74,7 +74,7 @@
   config :custom_fields, :validate => :hash, :default => {}

   # The GELF full message. Dynamic values like `%{foo}` are permitted here.
-  config :full_message, :validate => :string, :default => "%{message}"
+  config :full_message, :validate => :string, :default => nil

   # The GELF short message field name. If the field does not exist or is empty,
   # the event message is taken instead.
@@ -150,7 +150,9 @@
       end
     end

-    m["full_message"] = event.sprintf(@full_message)
+    if @full_message
+      m["full_message"] = event.sprintf(@full_message)
+    end

     m["host"] = event.sprintf(@sender)