azure-loganalytics-datacollector-api 0.1.2 → 0.1.4
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f69486484bc9d5e52f6ecaf48c049ff178f85594a1ff83a9c1922db1a30666bc
|
4
|
+
data.tar.gz: c4b1c23ccc77e0273b1447ae5464279270f05ca3f96d2f0e8d2d9e516d198758
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e5dd0c8db1d44a861d2506200d7f93b668ac3d8d8a444bea73bed0e464166aa4c194f123a7482e007ed4a67da01ce5aea60933aa95cd667b04a32bdcba3591e
|
7
|
+
data.tar.gz: 72d70760c358307f6b1fb8520bdb30d42e30217174c35875d236dad9799245b9aff7f4b5708a6d329a5c49adc8c73063aeec989a27afa44104c0de8986c2147e
|
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,96 @@
|
|
2
2
|
Azure Log Analytics Data Collector API Ruby Client
|
3
3
|
|
4
4
|
## Installation
|
5
|
-
```
|
5
|
+
```bash
|
6
6
|
gem install azure-loganalytics-datacollector-api
|
7
7
|
```
|
8
8
|
|
9
|
+
## Sample code (Ruby Client)
|
10
|
+
### Sample1 - No time_generated_field option
|
11
|
+
```ruby
|
12
|
+
require "azure/loganalytics/datacollectorapi/client"
|
13
|
+
|
14
|
+
customer_id = '<Customer ID aka WorkspaceID String>'
|
15
|
+
shared_key = '<The primary or the secondary Connected Sources client authentication key>'
|
16
|
+
log_type = "MyCustomLog"
|
17
|
+
|
18
|
+
posting_records = []
|
19
|
+
record1= {
|
20
|
+
:string => "MyText1",
|
21
|
+
:boolean => true,
|
22
|
+
:number => 100
|
23
|
+
}
|
24
|
+
record2= {
|
25
|
+
:string => "MyText2",
|
26
|
+
:boolean => false,
|
27
|
+
:number => 200
|
28
|
+
}
|
29
|
+
posting_records.push(record1)
|
30
|
+
posting_records.push(record2)
|
31
|
+
|
32
|
+
client=Azure::Loganalytics::Datacollectorapi::Client::new( customer_id, shared_key)
|
33
|
+
res = client.post_data(log_type, posting_records)
|
34
|
+
puts res
|
35
|
+
puts "res code=#{res.code}"
|
36
|
+
|
37
|
+
if Azure::Loganalytics::Datacollectorapi::Client.is_success(res)
|
38
|
+
puts "operation was succeeded!"
|
39
|
+
else
|
40
|
+
puts "operation was failured!"
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
### Sample2 - With time_generated_field option
|
45
|
+
```ruby
|
46
|
+
require "azure/loganalytics/datacollectorapi/client"
|
47
|
+
|
48
|
+
customer_id = '<Customer ID aka WorkspaceID String>'
|
49
|
+
shared_key = '<The primary or the secondary Connected Sources client authentication key>'
|
50
|
+
log_type = "MyCustomLog"
|
51
|
+
|
52
|
+
posting_records = []
|
53
|
+
record1= {
|
54
|
+
:string => "MyText1",
|
55
|
+
:boolean => true,
|
56
|
+
:number => 100,
|
57
|
+
:timegen => "2017-11-23T11:13:35.576Z" # YYYY-MM-DDThh:mm:ssZ
|
58
|
+
}
|
59
|
+
record2= {
|
60
|
+
:string => "MyText2",
|
61
|
+
:boolean => false,
|
62
|
+
:number => 200,
|
63
|
+
:timegen => "2017-11-23T12:13:35.576Z" # YYYY-MM-DDThh:mm:ssZ
|
64
|
+
}
|
65
|
+
posting_records.push(record1)
|
66
|
+
posting_records.push(record2)
|
67
|
+
|
68
|
+
time_generated_field = "timegen"
|
69
|
+
client=Azure::Loganalytics::Datacollectorapi::Client::new( customer_id, shared_key)
|
70
|
+
res = client.post_data(log_type, posting_records, time_generated_field)
|
71
|
+
puts res
|
72
|
+
puts "res code=#{res.code}"
|
73
|
+
|
74
|
+
if Azure::Loganalytics::Datacollectorapi::Client.is_success(res)
|
75
|
+
puts "operation was succeeded!"
|
76
|
+
else
|
77
|
+
puts "operation was failured!"
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
### Sample3 - use proxy to access the API
|
82
|
+
```ruby
|
83
|
+
require "azure/loganalytics/datacollectorapi/client"
|
84
|
+
|
85
|
+
...
|
86
|
+
client=Azure::Loganalytics::Datacollectorapi::Client::new( customer_id, shared_key)
|
87
|
+
# client.set_proxy() # ENV['http_proxy'] is set by default
|
88
|
+
client.set_proxy(your_proxy)
|
89
|
+
res = client.post_data(log_type, posting_records, time_generated_field)
|
90
|
+
puts res
|
91
|
+
...
|
92
|
+
```
|
93
|
+
|
94
|
+
|
9
95
|
## Change log
|
10
96
|
|
11
97
|
* [Changelog](ChangeLog.md)
|
@@ -12,32 +12,18 @@ describe Azure::Loganalytics::Datacollectorapi::Client do
|
|
12
12
|
it "posting data to datacollector api" do
|
13
13
|
customer_id = '<Customer ID aka WorkspaceID String>'
|
14
14
|
shared_key = '<Primary Key String>'
|
15
|
-
log_type = "
|
15
|
+
log_type = "MyCustomLog"
|
16
16
|
|
17
17
|
json_records = []
|
18
18
|
record1= {
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:remote => "101.202.74.59",
|
23
|
-
:user => "-",
|
24
|
-
:method => "GET / HTTP/1.1",
|
25
|
-
:status => "304",
|
26
|
-
:size => "-",
|
27
|
-
:referer => "-",
|
28
|
-
:agent => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:27.0) Gecko/20100101 Firefox/27.0"
|
19
|
+
:string => "MyText1",
|
20
|
+
:boolean => true,
|
21
|
+
:number => 100
|
29
22
|
}
|
30
|
-
record2
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:remote => "201.78.74.59",
|
35
|
-
:user => "-",
|
36
|
-
:method => "GET /manager/html HTTP/1.1",
|
37
|
-
:status =>"200",
|
38
|
-
:size => "-",
|
39
|
-
:referer => "-",
|
40
|
-
:agent => "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"
|
23
|
+
record2= {
|
24
|
+
:string => "MyText2",
|
25
|
+
:boolean => false,
|
26
|
+
:number => 200
|
41
27
|
}
|
42
28
|
json_records.push(record1)
|
43
29
|
json_records.push(record2)
|
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.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoichi Kawasaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -108,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
|
112
|
-
rubygems_version: 2.6.2
|
111
|
+
rubygems_version: 3.0.3
|
113
112
|
signing_key:
|
114
113
|
specification_version: 4
|
115
114
|
summary: Azure Log Analytics Data Collector API Ruby Client
|