Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/fluent/plugin/in_cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'time'
require 'fluent/plugin/input'
require 'fluent/plugin/parser'
require 'yajl'

module Fluent::Plugin
class CloudwatchLogsInput < Input
Expand Down Expand Up @@ -36,7 +35,7 @@ class CloudwatchLogsInput < Input
deprecated: "Use <storage> instead."
config_param :fetch_interval, :time, default: 60
config_param :http_proxy, :string, default: nil
config_param :json_handler, :enum, list: [:yajl, :json], default: :yajl
config_param :json_handler, :enum, list: [:yajl, :json], default: :json # NOTE: Contains yajl for backward compatibility
config_param :use_todays_log_stream, :bool, default: false
config_param :use_aws_timestamp, :bool, default: false
config_param :start_time, :string, default: nil
Expand Down Expand Up @@ -133,7 +132,8 @@ def start

@json_handler = case @json_handler
when :yajl
Yajl
log.info "json_handler 'yajl' is deprecated. Please use 'json' instead."
JSON
when :json
JSON
end
Expand Down Expand Up @@ -264,7 +264,7 @@ def emit(group, stream, event, metadata)
record.merge!("metadata" => metadata)
end
router.emit(@tag, time, record)
rescue JSON::ParserError, Yajl::ParseError => error # Catch parser errors
rescue JSON::ParserError => error # Catch parser errors
log.error "Invalid JSON encountered while parsing event.message"
router.emit_error_event(@tag, time, { message: event.message }, error)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fluent/plugin/out_cloudwatch_logs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'fluent/plugin/output'
require 'fluent/msgpack_factory'
require 'thread'
require 'yajl'

module Fluent::Plugin
class CloudwatchLogsOutput < Output
Expand Down Expand Up @@ -50,7 +49,7 @@ class TooLargeEventError < Fluent::UnrecoverableError; end
config_param :retention_in_days, :integer, default: nil
config_param :retention_in_days_key, :string, default: nil
config_param :remove_retention_in_days_key, :bool, default: false
config_param :json_handler, :enum, list: [:yajl, :json], :default => :yajl
config_param :json_handler, :enum, list: [:yajl, :json], :default => :json
config_param :log_rejected_request, :bool, :default => false
config_section :web_identity_credentials, multi: false do
config_param :role_arn, :string
Expand Down Expand Up @@ -169,7 +168,8 @@ def start

@json_handler = case @json_handler
when :yajl
Yajl
log.info "json_handler 'yajl' is deprecated. Please use 'json' instead."
JSON
when :json
JSON
end
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_in_cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_configure
assert_equal('stream', d.instance.log_stream_name)
assert_equal(true, d.instance.use_log_stream_name_prefix)
assert_equal('/tmp/state', d.instance.state_file)
assert_equal(:yajl, d.instance.json_handler)
assert_equal(:json, d.instance.json_handler)
assert_equal(true, d.instance.use_aws_timestamp)
assert_equal(1560816000000, d.instance.start_time)
assert_equal(1579305600000, d.instance.end_time)
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_out_cloudwatch_logs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_configure
assert_equal("tagvalue", d.instance.log_group_aws_tags.fetch("tagkey"))
assert_equal("tagvalue_2", d.instance.log_group_aws_tags.fetch("tagkey_2"))
assert_equal(5, d.instance.retention_in_days)
assert_equal(:yajl, d.instance.json_handler)
assert_equal(:json, d.instance.json_handler)
assert_equal(["fluentd","aws","cloudwatch"], d.instance.message_keys)
end
end
Expand Down
Loading