Input plugin of Azure Monitor Logs for Fluentd
Перейти к файлу
Tomer Rosenthal 0fa65e37d3
update yajl-ruby to 1.3.1
2017-12-09 14:54:10 +02:00
lib/fluent/plugin save the end time of the query 2017-10-24 13:18:52 +00:00
test Fix code review comments and rename solution 2017-10-23 15:07:08 +00:00
.gitignore Initial commit 2017-10-17 09:25:45 +01:00
Gemfile initial commit 2017-10-17 14:22:05 +01:00
Gemfile.fluentd.0.12 initial commit 2017-10-17 14:22:05 +01:00
Gemfile.lock update yajl-ruby to 1.3.1 2017-12-09 14:54:10 +02:00
LICENSE Update LICENSE 2017-10-23 15:08:31 +00:00
README.md Update README.md 2017-10-24 11:25:52 +03:00
Rakefile initial commit 2017-10-17 14:22:05 +01:00
fluent-plugin-azuremonitorlog.gemspec Update fluent-plugin-azuremonitorlog.gemspec 2017-12-07 10:06:47 +02:00

README.md

fluent-plugin-azuremonitorlog, a plugin for Fluentd

Overview

Azure Monitor log input plugin.

This plugin gets the monitor activity logs from Azure Monitor API to fluentd.

Installation

To use this plugin, you need to have Azure Service Principal.
Create an Azure Service Principal through Azure CLI or Azure portal.

Install plugin from RubyGems:

$ gem install fluent-plugin-azuremonitorlog

Configuration

<source>
  @type azuremonitorlog
  tag azuremonitorlog
  tenant_id [Azure_Tenant_ID]
  subscription_id [Azure_Subscription_Id]
  client_id [Azure_Client_Id]
  client_secret [Azure_Client_Secret]
  
  select [selected fields to query]
  filter [filter the query query] (default: eventChannels eq 'Admin, Operation')
  interval [interval in seconds] (default: 300)
  api_version [api version] (default: 2015-04-01)
</source>

Documentation for select and filter can be found here

Example for source config

<source>
    @type azuremonitorlog
    tag azuremonitorlog
    tenant_id [Azure_Tenant_ID]
    subscription_id [Azure_Subscription_Id]
    client_id [Azure_Client_Id]
    client_secret [Azure_Client_Secret]
    select_filter eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level
</source>

Start fluentd:

$ fluentd -c ./fluentd.conf

output example:

{
	"correlationId": "00000000-0000-0000-0000-000000000000",
	"eventName": {
		"value": "EndRequest",
		"localizedValue": "End request"
	},
	"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/events/00000000-0000-0000-0000-000000000000/ticks/636444295616045190",
	"resourceGroupName": "myresourcegroup",
	"resourceProviderName": {
		"value": "Microsoft.Resources",
		"localizedValue": "Microsoft Resources"
	},
	"operationName": {
		"value": "Microsoft.Resources/subscriptions/resourcegroups/write",
		"localizedValue": "Update resource group"
	},
	"status": {
		"value": "Succeeded",
		"localizedValue": "Succeeded"
	},
	"eventTimestamp": "2017-10-24T08:12:41.604519Z"
}

Test

Run tests:

$ rake test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request