From 4d4f210fbe4041b2c8e38b41b79a84ae86dc6dea Mon Sep 17 00:00:00 2001 From: Imron Alston Date: Wed, 14 Feb 2018 10:25:42 +0000 Subject: [PATCH] evaluating ruby contained in server_attribute strings --- VERSION | 2 +- lib/fluent/plugin/out_scalyr.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 100435b..ee94dd8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/lib/fluent/plugin/out_scalyr.rb b/lib/fluent/plugin/out_scalyr.rb index db6371d..b125e06 100644 --- a/lib/fluent/plugin/out_scalyr.rb +++ b/lib/fluent/plugin/out_scalyr.rb @@ -87,6 +87,22 @@ def configure( conf ) end end + #evaluate any statements in string value of the server_attributes object + if @server_attributes + new_attributes = {} + @server_attributes.each do |key, value| + if value.is_a?( String ) + m = /^\#{(.*)}$/.match( value ) + if m + new_attributes[key] = eval( m[1] ) + else + new_attributes[key] = value + end + end + end + @server_attributes = new_attributes + end + @scalyr_server << '/' unless @scalyr_server.end_with?('/') @add_events_uri = URI @scalyr_server + "addEvents"