Skip to content

Commit 9923482

Browse files
authored
Merge pull request #18 from yokawasa/x-ms-azureresourceid-header
release 0.5.0
2 parents 3c24dd9 + 1dd65f1 commit 9923482

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.0
2+
3+
* Support setting the [x-ms-AzureResourceId](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-collector-api#request-headers) Header - [issue #17](https://github.com/yokawasa/fluent-plugin-azure-loganalytics/issues/17)
4+
15
## 0.4.2
26
* fix CVE-2020-8130 - [issue #13](https://github.com/yokawasa/fluent-plugin-azure-loganalytics/issues/13)
37

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Once you have the workspace, get Workspace ID and Shared Key (either Primary Key
5858
* **log\_type (required)** - The name of the event type that is being submitted to Log Analytics. log_type only supports alpha characters
5959
* **endpoint (optional)** - Default:'ods.opinsights.azure.com'. The service endpoint. You may want to use this param in case of sovereign cloud that has a different endpoint from the public cloud
6060
* **time\_generated\_field (optional)** - Default:''(empty string) The name of the time generated field. Be carefule that the value of field should strictly follow the ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). See also [this](https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-collector-api#create-a-request) for more details
61+
* **azure\_resource\_id (optional)** - Default:''(empty string) The resource ID of the Azure resource the data should be associated with. This populates the [_ResourceId](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/log-standard-properties#_resourceid) property and allows the data to be included in [resource-context](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/design-logs-deployment#access-mode) queries in Azure Log Analytics (Azure Monitor). If this field isn't specified, the data will not be included in resource-context queries. The format should be like /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. Please see [this](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource#resourceid) for more detail on the resource ID format.
62+
6163
* **add\_time\_field (optional)** - Default:true. This option allows to insert a time field to record
6264
* **time\_field\_name (optional)** - Default:time. This is required only when add_time_field is true
6365
* **localtime (optional)** - Default:false. Time record is inserted with UTC (Coordinated Universal Time) by default. This option allows to use local time if you set localtime true. This is valid only when add_time_field is true
@@ -105,6 +107,7 @@ fluent-plugin-azure-loganalytics adds **time** and **tag** attributes by default
105107
customer_id 818f7bbc-8034-4cc3-b97d-f068dd4cd658
106108
shared_key ppC5500KzCcDsOKwM1yWUvZydCuC3m+ds/2xci0byeQr1G3E0Jkygn1N0Rxx/yVBUrDE2ok3vf4ksCzvBmQXHw==(dummy)
107109
log_type ApacheAccessLog
110+
azure_resource_id /subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/otherResourceGroup/providers/Microsoft.Storage/storageAccounts/examplestorage
108111
add_time_field true
109112
time_field_name mytime
110113
time_format %s

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.2
1+
0.5.0

examples/fluent_2.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
customer_id CUSTOMER_ID # Customer ID aka WorkspaceID String
1212
shared_key KEY_STRING # The primary or the secondary Connected Sources client authentication key
1313
log_type EVENT_TYPE_NAME # The name of the event type. ex) ApacheAccessLog
14+
azure_resource_id RESOURCE_ID # format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
1415
add_time_field true
1516
time_field_name mytime
1617
time_format %s

lib/fluent/plugin/out_azure-loganalytics.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class AzureLogAnalyticsOutput < Output
2222
:desc => "The name of the event type that is being submitted to Log Analytics. log_type only alpha characters"
2323
config_param :time_generated_field, :string, :default => '',
2424
:desc => "The name of the time generated field. Be carefule that the value of field should strictly follow the ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)"
25+
config_param :azure_resource_id, :string, :default => '',
26+
:desc => "Resource ID of the Azure resource the data should be associated with. This populates the _ResourceId property and allows the data to be included in resource-context queries in Azure Log Analytics (Azure Monitor). If this field isn't specified, the data will not be included in resource-context queries. The format should be like /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
2527
config_param :add_time_field, :bool, :default => true,
2628
:desc => "This option allows to insert a time field to record"
2729
config_param :time_field_name, :string, :default => "time",
@@ -93,7 +95,7 @@ def write(chunk)
9395
records.push(record)
9496
}
9597
begin
96-
res = @client.post_data(@log_type, records, @time_generated_field)
98+
res = @client.post_data(@log_type, records, @time_generated_field, @azure_resource_id)
9799
if not Azure::Loganalytics::Datacollectorapi::Client.is_success(res)
98100
log.fatal "DataCollector API request failure: error code: " +
99101
"#{res.code}, data=>" + Yajl.dump(records)

0 commit comments

Comments
 (0)