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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ The tag of the event.

The url of remote server.

### agent (string) (optional, default: fluent-plugin-http-pull)

The user agent string of request.

### interval (time) (required)

The interval time between periodic request.
Expand Down
2 changes: 1 addition & 1 deletion fluent-plugin-http-pull.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = "fluent-plugin-http-pull"
spec.version = "0.6.1"
spec.version = "0.7.0"
spec.authors = ["filepang"]
spec.email = ["filepang@gmail.com"]

Expand Down
6 changes: 5 additions & 1 deletion lib/fluent/plugin/in_http_pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def initialize
desc 'The interval time between periodic request'
config_param :interval, :time

desc 'The user agent string of request'
config_param :agent, :string, default: "fluent-plugin-http-pull"

desc 'status_only'
config_param :status_only, :bool, default: false

Expand Down Expand Up @@ -72,7 +75,8 @@ def configure(conf)

@parser = parser_create unless @status_only
@_request_headers = {
"Content-Type" => "application/x-www-form-urlencoded"
"Content-Type" => "application/x-www-form-urlencoded",
"User-Agent" => @agent
}.merge(@request_headers.map do |section|
header = section["header"]
value = section["value"]
Expand Down
7 changes: 7 additions & 0 deletions test/plugin/test_in_http_pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class HttpPullInputTestDefaultOptions < Test::Unit::TestCase

assert_equal(:get, d.instance.http_method)
end

test 'agent' do
d = create_driver TEST_DEFAULT_VALUE_CONFIG
assert_equal("test", d.instance.tag)

assert_equal("fluent-plugin-http-pull", d.instance.agent)
end
end

private
Expand Down