azure-loganalytics-datacollector-api 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0499f95d897bc46dae9b39636ac2dda0c9aa5750b70bc2703c0d3dc41bfa34f1'
4
- data.tar.gz: 057401456546b8ac6b23e75bbc0e6c61a8a4c9ddb534f54508018011d3268d85
3
+ metadata.gz: 3d3abe715a08517a56495053c816fc36a814c4d373e82af5d96a108cc9ee5d31
4
+ data.tar.gz: db6499466afb04d793a80ca16ed91cc3654dbc7cb897c9e8e0a7dec3cce15d5f
5
5
  SHA512:
6
- metadata.gz: ed73c860640a73f1d0d0176e482361ebb30a082634410c44b7d540fc444b56e1a6548d1f81b43f10f5aef9967e1e8d17b63379c377250ed00b050157c29d4f79
7
- data.tar.gz: 5bcb8d45153164a92ddeeaae37544d7722806c8726e2653d2f3fefa07e65f93f854e26e4e657cb9fef1d1d1c26d68d69daa963266b28cb62bfcaef1cbde42b29
6
+ metadata.gz: 76263c50638ec683371727e61240bb705242226757fb928c841896b6a0a22af48ce76cc9afefdf2a5271b2dee50e13ee2346d866ee35c3bfac6e985e7bc71cce
7
+ data.tar.gz: 87220e1418b867e5eb1a8e32a182c0a6e2ff813405d493e67473dc7f049bca382f14003c9548a2342a9f4b53563c8565ade2d79b393a7691f13c0f3580af61e7
@@ -1,25 +1,38 @@
1
+ # ChangeLog
2
+
3
+ ## 0.5.0
4
+
5
+ * Check body size not to exceed data limit of 30MB in Azure Monitor Data Collection API - [issue #12](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/12)
6
+
1
7
  ## 0.4.0
8
+
2
9
  * restclient retries request on the following status code - [issue #10](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/10)
3
10
  * 429 - Too Many Requests
4
11
  * 500 - Internal Server Error
5
12
  * 503 - Service Unavailable
6
13
 
7
14
  ## 0.3.0
15
+
8
16
  * Enhance log type validation: check not only alpha but also numeric, underscore, and character length (may not exceed 100) - [issue #11](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/11)
9
17
 
10
18
  ## 0.2.0
19
+
11
20
  * Support setting the x-ms-AzureResourceId Header - [issue #8](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/8)
12
21
 
13
22
  ## 0.1.6
23
+
14
24
  * fix CVE-2020-8130 - [issue #7](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/7)
15
25
 
16
26
  ## 0.1.5
27
+
17
28
  * Add endpoint parameter with the default value for Azure public - [PR#5](https://github.com/yokawasa/azure-log-analytics-data-collector/pull/5)
18
29
 
19
30
  ## 0.1.4
31
+
20
32
  * Add `set_proxy` method to client - [issue#3](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/3)
21
33
 
22
34
  ## 0.1.2
35
+
23
36
  * fixedup bug - [issue #1](https://github.com/yokawasa/azure-log-analytics-data-collector/issues/1)
24
37
 
25
38
  ## 0.1.1
@@ -10,6 +10,9 @@ module Azure
10
10
 
11
11
  DEFAUT_MAX_RETRIES = 3.freeze
12
12
  DEFAULT_RETRY_SLEEP_PERIOD = 5.freeze
13
+ # API Data Limits
14
+ # https://docs.microsoft.com/en-us/azure/azure-monitor/platform/data-collector-api#data-limits
15
+ MAX_BODY_BYTE_SIZE = 31457280.freeze # 30 MB
13
16
 
14
17
  def initialize (customer_id, shared_key, endpoint ='ods.opinsights.azure.com')
15
18
  require 'rest-client'
@@ -31,7 +34,11 @@ module Azure
31
34
  raise ConfigError, 'no log_type' if log_type.empty?
32
35
  raise ConfigError, 'log_type must only contain alpha numeric and _, and not exceed 100 chars' if not is_valid_log_type(log_type)
33
36
  raise ConfigError, 'no json_records' if json_records.empty?
37
+
34
38
  body = json_records.to_json
39
+ body_size = body.bytesize
40
+ raise "too large payload (#{body_size})! max post data size is #{MAX_BODY_BYTE_SIZE} bytes!" if body_size >= MAX_BODY_BYTE_SIZE
41
+
35
42
  uri = sprintf("https://%s.%s/api/logs?api-version=%s",
36
43
  @customer_id, @endpoint, API_VERSION)
37
44
  date = rfc1123date()
@@ -1,7 +1,7 @@
1
1
  module Azure
2
2
  module Loganalytics
3
3
  module Datacollectorapi
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-loganalytics-datacollector-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichi Kawasaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.1.3
98
+ rubygems_version: 3.1.4
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Azure Log Analytics Data Collector API Ruby Client