Class: Fluent::AzureMonitorLogInput
- Inherits:
-
Input
- Object
- Input
- Fluent::AzureMonitorLogInput
- Defined in:
- lib/fluent/plugin/in_azuremonitorlog.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ AzureMonitorLogInput
constructor
A new instance of AzureMonitorLogInput.
- #set_query_options(filter, custom_headers) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ AzureMonitorLogInput
Returns a new instance of AzureMonitorLogInput.
28 29 30 |
# File 'lib/fluent/plugin/in_azuremonitorlog.rb', line 28 def initialize super end |
Instance Method Details
#configure(conf) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/in_azuremonitorlog.rb', line 32 def configure(conf) super provider = MsRestAzure::ApplicationTokenProvider.new(@tenant_id, @client_id, @client_secret) credentials = MsRest::TokenCredentials.new(provider) @client = Azure::ARM::Monitor::MonitorManagementClient.new(credentials); @client.subscription_id = @subscription_id end |
#set_query_options(filter, custom_headers) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fluent/plugin/in_azuremonitorlog.rb', line 54 def (filter, custom_headers) fail ArgumentError, 'path is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @api_version, '$filter' => filter, '$select' => @select}, headers: request_headers.merge(custom_headers || {}), base_url: @client.base_url } end |
#shutdown ⇒ Object
47 48 49 50 51 52 |
# File 'lib/fluent/plugin/in_azuremonitorlog.rb', line 47 def shutdown super @finished = true @watcher.terminate @watcher.join end |
#start ⇒ Object
41 42 43 44 45 |
# File 'lib/fluent/plugin/in_azuremonitorlog.rb', line 41 def start super @finished = false @watcher = Thread.new(&method(:watch)) end |