Skip to content

Commit 262aa2a

Browse files
author
Yoichi Kawasaki
committed
Added log_type's only alpha characters check
1 parent f4d60bd commit 262aa2a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.3.1
2+
3+
* Add requirements section - [PR#2](https://github.com/yokawasa/fluent-plugin-azure-loganalytics/pull/2)
4+
* Add log_type characters check as log_type only supports alpha characters - [Issue#3](https://github.com/yokawasa/fluent-plugin-azure-loganalytics/issues/3)
5+
16
## 0.3.0
27

38
* Migrate to use fluentd v0.14 API - [PR#1](https://github.com/yokawasa/fluent-plugin-azure-loganalytics/pull/1)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Once you have the workspace, get Workspace ID and Shared Key (either Primary Key
4444

4545
* **customer\_id (required)** - Your Operations Management Suite workspace ID
4646
* **shared\_key (required)** - The primary or the secondary Connected Sources client authentication key
47-
* **log\_type (required)** - The name of the event type that is being submitted to Log Analytics
47+
* **log\_type (required)** - The name of the event type that is being submitted to Log Analytics. log_type only supports alpha characters
4848
* **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
4949
* **add\_time\_field (optional)** - Default:true. This option allows to insert a time field to record
5050
* **time\_field\_name (optional)** - Default:time. This is required only when add_time_field is true

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.3.1

lib/fluent/plugin/out_azure-loganalytics.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AzureLogAnalyticsOutput < Output
1717
config_param :shared_key, :string, :secret => true,
1818
:desc => "The primary or the secondary Connected Sources client authentication key"
1919
config_param :log_type, :string,
20-
:desc => "The name of the event type that is being submitted to Log Analytics"
20+
:desc => "The name of the event type that is being submitted to Log Analytics. log_type only alpha characters"
2121
config_param :time_generated_field, :string, :default => '',
2222
: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)"
2323
config_param :add_time_field, :bool, :default => true,
@@ -44,6 +44,9 @@ def configure(conf)
4444
raise Fluent::ConfigError, 'no customer_id' if @customer_id.empty?
4545
raise Fluent::ConfigError, 'no shared_key' if @shared_key.empty?
4646
raise Fluent::ConfigError, 'no log_type' if @log_type.empty?
47+
if not @log_type.match(/^[[:alpha:]]+$/)
48+
raise Fluent::ConfigError, 'log_type supports only alpha characters'
49+
end
4750
if @add_time_field and @time_field_name.empty?
4851
raise Fluent::ConfigError, 'time_field_name must be set if add_time_field is true'
4952
end

0 commit comments

Comments
 (0)