splunk-sdk-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/CHANGELOG.md +160 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE +177 -0
  4. data/README.md +310 -0
  5. data/Rakefile +40 -0
  6. data/examples/1_connect.rb +51 -0
  7. data/examples/2_manage.rb +103 -0
  8. data/examples/3_blocking_searches.rb +82 -0
  9. data/examples/4_asynchronous_searches.rb +79 -0
  10. data/examples/5_stream_data_to_splunk.rb +79 -0
  11. data/lib/splunk-sdk-ruby.rb +47 -0
  12. data/lib/splunk-sdk-ruby/ambiguous_entity_reference.rb +28 -0
  13. data/lib/splunk-sdk-ruby/atomfeed.rb +323 -0
  14. data/lib/splunk-sdk-ruby/collection.rb +417 -0
  15. data/lib/splunk-sdk-ruby/collection/apps.rb +35 -0
  16. data/lib/splunk-sdk-ruby/collection/case_insensitive_collection.rb +58 -0
  17. data/lib/splunk-sdk-ruby/collection/configuration_file.rb +50 -0
  18. data/lib/splunk-sdk-ruby/collection/configurations.rb +80 -0
  19. data/lib/splunk-sdk-ruby/collection/jobs.rb +136 -0
  20. data/lib/splunk-sdk-ruby/collection/messages.rb +51 -0
  21. data/lib/splunk-sdk-ruby/context.rb +522 -0
  22. data/lib/splunk-sdk-ruby/entity.rb +260 -0
  23. data/lib/splunk-sdk-ruby/entity/index.rb +191 -0
  24. data/lib/splunk-sdk-ruby/entity/job.rb +339 -0
  25. data/lib/splunk-sdk-ruby/entity/message.rb +36 -0
  26. data/lib/splunk-sdk-ruby/entity/saved_search.rb +71 -0
  27. data/lib/splunk-sdk-ruby/entity/stanza.rb +45 -0
  28. data/lib/splunk-sdk-ruby/entity_not_ready.rb +26 -0
  29. data/lib/splunk-sdk-ruby/illegal_operation.rb +27 -0
  30. data/lib/splunk-sdk-ruby/namespace.rb +239 -0
  31. data/lib/splunk-sdk-ruby/resultsreader.rb +716 -0
  32. data/lib/splunk-sdk-ruby/service.rb +339 -0
  33. data/lib/splunk-sdk-ruby/splunk_http_error.rb +49 -0
  34. data/lib/splunk-sdk-ruby/synonyms.rb +50 -0
  35. data/lib/splunk-sdk-ruby/version.rb +27 -0
  36. data/lib/splunk-sdk-ruby/xml_shim.rb +117 -0
  37. data/splunk-sdk-ruby.gemspec +27 -0
  38. data/test/atom_test_data.rb +472 -0
  39. data/test/data/atom/atom_feed_with_message.xml +19 -0
  40. data/test/data/atom/atom_with_feed.xml +99 -0
  41. data/test/data/atom/atom_with_several_entries.xml +101 -0
  42. data/test/data/atom/atom_with_simple_entries.xml +30 -0
  43. data/test/data/atom/atom_without_feed.xml +248 -0
  44. data/test/data/export/4.2.5/export_results.xml +88 -0
  45. data/test/data/export/4.3.5/export_results.xml +87 -0
  46. data/test/data/export/5.0.1/export_results.xml +78 -0
  47. data/test/data/export/5.0.1/nonreporting.xml +232 -0
  48. data/test/data/results/4.2.5/results-empty.xml +0 -0
  49. data/test/data/results/4.2.5/results-preview.xml +255 -0
  50. data/test/data/results/4.2.5/results.xml +336 -0
  51. data/test/data/results/4.3.5/results-empty.xml +0 -0
  52. data/test/data/results/4.3.5/results-preview.xml +1057 -0
  53. data/test/data/results/4.3.5/results.xml +626 -0
  54. data/test/data/results/5.0.2/results-empty.xml +1 -0
  55. data/test/data/results/5.0.2/results-empty_preview.xml +1 -0
  56. data/test/data/results/5.0.2/results-preview.xml +448 -0
  57. data/test/data/results/5.0.2/results.xml +501 -0
  58. data/test/export_test_data.json +360 -0
  59. data/test/resultsreader_test_data.json +1119 -0
  60. data/test/services.server.info.xml +43 -0
  61. data/test/services.xml +111 -0
  62. data/test/test_atomfeed.rb +71 -0
  63. data/test/test_collection.rb +278 -0
  64. data/test/test_configuration_file.rb +124 -0
  65. data/test/test_context.rb +119 -0
  66. data/test/test_entity.rb +95 -0
  67. data/test/test_helper.rb +250 -0
  68. data/test/test_http_error.rb +52 -0
  69. data/test/test_index.rb +91 -0
  70. data/test/test_jobs.rb +319 -0
  71. data/test/test_messages.rb +17 -0
  72. data/test/test_namespace.rb +188 -0
  73. data/test/test_restarts.rb +49 -0
  74. data/test/test_resultsreader.rb +106 -0
  75. data/test/test_roles.rb +41 -0
  76. data/test/test_saved_searches.rb +119 -0
  77. data/test/test_service.rb +65 -0
  78. data/test/test_users.rb +33 -0
  79. data/test/test_xml_shim.rb +28 -0
  80. data/test/testfile.txt +1 -0
  81. metadata +200 -0
@@ -0,0 +1,88 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <results preview='1'>
3
+ <meta>
4
+ <fieldOrder>
5
+ <field>method</field>
6
+ <field>count(_raw)</field>
7
+ </fieldOrder>
8
+ </meta>
9
+ <messages>
10
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
11
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.2.5.6/etc"</msg>
12
+ </messages>
13
+
14
+ <result offset='0'>
15
+ <field k='method'>
16
+ <value><text>GET</text></value>
17
+ </field>
18
+ <field k='count(_raw)'>
19
+ <value><text>16</text></value>
20
+ </field>
21
+ </result>
22
+ <result offset='1'>
23
+ <field k='method'>
24
+ <value><text>POST</text></value>
25
+ </field>
26
+ <field k='count(_raw)'>
27
+ <value><text>3</text></value>
28
+ </field>
29
+ </result>
30
+ </results>
31
+ <results preview='1'>
32
+ <meta>
33
+ <fieldOrder>
34
+ <field>method</field>
35
+ <field>count(_raw)</field>
36
+ </fieldOrder>
37
+ </meta>
38
+ <messages>
39
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
40
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.2.5.6/etc"</msg>
41
+ </messages>
42
+
43
+ <result offset='0'>
44
+ <field k='method'>
45
+ <value><text>GET</text></value>
46
+ </field>
47
+ <field k='count(_raw)'>
48
+ <value><text>16</text></value>
49
+ </field>
50
+ </result>
51
+ <result offset='1'>
52
+ <field k='method'>
53
+ <value><text>POST</text></value>
54
+ </field>
55
+ <field k='count(_raw)'>
56
+ <value><text>7</text></value>
57
+ </field>
58
+ </result>
59
+ </results>
60
+ <results preview='0'>
61
+ <meta>
62
+ <fieldOrder>
63
+ <field>method</field>
64
+ <field>count(_raw)</field>
65
+ </fieldOrder>
66
+ </meta>
67
+ <messages>
68
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
69
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.2.5.6/etc"</msg>
70
+ </messages>
71
+
72
+ <result offset='0'>
73
+ <field k='method'>
74
+ <value><text>GET</text></value>
75
+ </field>
76
+ <field k='count(_raw)'>
77
+ <value><text>16</text></value>
78
+ </field>
79
+ </result>
80
+ <result offset='1'>
81
+ <field k='method'>
82
+ <value><text>POST</text></value>
83
+ </field>
84
+ <field k='count(_raw)'>
85
+ <value><text>7</text></value>
86
+ </field>
87
+ </result>
88
+ </results>
@@ -0,0 +1,87 @@
1
+ <results preview='1'>
2
+ <meta>
3
+ <fieldOrder>
4
+ <field>method</field>
5
+ <field>count(_raw)</field>
6
+ </fieldOrder>
7
+ </meta>
8
+ <messages>
9
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
10
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.3.5/etc"</msg>
11
+ </messages>
12
+
13
+ <result offset='0'>
14
+ <field k='method'>
15
+ <value><text>GET</text></value>
16
+ </field>
17
+ <field k='count(_raw)'>
18
+ <value><text>37</text></value>
19
+ </field>
20
+ </result>
21
+ <result offset='1'>
22
+ <field k='method'>
23
+ <value><text>POST</text></value>
24
+ </field>
25
+ <field k='count(_raw)'>
26
+ <value><text>5</text></value>
27
+ </field>
28
+ </result>
29
+ </results>
30
+ <results preview='1'>
31
+ <meta>
32
+ <fieldOrder>
33
+ <field>method</field>
34
+ <field>count(_raw)</field>
35
+ </fieldOrder>
36
+ </meta>
37
+ <messages>
38
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
39
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.3.5/etc"</msg>
40
+ </messages>
41
+
42
+ <result offset='0'>
43
+ <field k='method'>
44
+ <value><text>GET</text></value>
45
+ </field>
46
+ <field k='count(_raw)'>
47
+ <value><text>41</text></value>
48
+ </field>
49
+ </result>
50
+ <result offset='1'>
51
+ <field k='method'>
52
+ <value><text>POST</text></value>
53
+ </field>
54
+ <field k='count(_raw)'>
55
+ <value><text>6</text></value>
56
+ </field>
57
+ </result>
58
+ </results>
59
+ <results preview='0'>
60
+ <meta>
61
+ <fieldOrder>
62
+ <field>method</field>
63
+ <field>count(_raw)</field>
64
+ </fieldOrder>
65
+ </meta>
66
+ <messages>
67
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
68
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-4.3.5/etc"</msg>
69
+ </messages>
70
+
71
+ <result offset='0'>
72
+ <field k='method'>
73
+ <value><text>GET</text></value>
74
+ </field>
75
+ <field k='count(_raw)'>
76
+ <value><text>41</text></value>
77
+ </field>
78
+ </result>
79
+ <result offset='1'>
80
+ <field k='method'>
81
+ <value><text>POST</text></value>
82
+ </field>
83
+ <field k='count(_raw)'>
84
+ <value><text>6</text></value>
85
+ </field>
86
+ </result>
87
+ </results>
@@ -0,0 +1,78 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <results preview='1'>
3
+ <meta>
4
+ <fieldOrder>
5
+ <field>method</field>
6
+ <field>count(_raw)</field>
7
+ </fieldOrder>
8
+ </meta>
9
+ <result offset='0'>
10
+ <field k='method'>
11
+ <value><text>GET</text></value>
12
+ </field>
13
+ <field k='count(_raw)'>
14
+ <value><text>3544</text></value>
15
+ </field>
16
+ </result>
17
+ <result offset='1'>
18
+ <field k='method'>
19
+ <value><text>POST</text></value>
20
+ </field>
21
+ <field k='count(_raw)'>
22
+ <value><text>437</text></value>
23
+ </field>
24
+ </result>
25
+ </results>
26
+ <results preview='1'>
27
+ <meta>
28
+ <fieldOrder>
29
+ <field>method</field>
30
+ <field>count(_raw)</field>
31
+ </fieldOrder>
32
+ </meta>
33
+ <result offset='0'>
34
+ <field k='method'>
35
+ <value><text>GET</text></value>
36
+ </field>
37
+ <field k='count(_raw)'>
38
+ <value><text>3544</text></value>
39
+ </field>
40
+ </result>
41
+ <result offset='1'>
42
+ <field k='method'>
43
+ <value><text>POST</text></value>
44
+ </field>
45
+ <field k='count(_raw)'>
46
+ <value><text>437</text></value>
47
+ </field>
48
+ </result>
49
+ </results>
50
+ <results preview='0'>
51
+ <meta>
52
+ <fieldOrder>
53
+ <field>method</field>
54
+ <field>count(_raw)</field>
55
+ </fieldOrder>
56
+ </meta>
57
+ <messages>
58
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
59
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-5.0.2/etc"</msg>
60
+ </messages>
61
+
62
+ <result offset='0'>
63
+ <field k='method'>
64
+ <value><text>GET</text></value>
65
+ </field>
66
+ <field k='count(_raw)'>
67
+ <value><text>3544</text></value>
68
+ </field>
69
+ </result>
70
+ <result offset='1'>
71
+ <field k='method'>
72
+ <value><text>POST</text></value>
73
+ </field>
74
+ <field k='count(_raw)'>
75
+ <value><text>437</text></value>
76
+ </field>
77
+ </result>
78
+ </results>
@@ -0,0 +1,232 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <results preview='0'>
3
+ <meta>
4
+ <fieldOrder>
5
+ <field>_bkt</field>
6
+ <field>_cd</field>
7
+ <field>_indextime</field>
8
+ <field>_raw</field>
9
+ <field>_serial</field>
10
+ <field>_si</field>
11
+ <field>_sourcetype</field>
12
+ <field>_subsecond</field>
13
+ <field>_time</field>
14
+ <field>host</field>
15
+ <field>index</field>
16
+ <field>linecount</field>
17
+ <field>source</field>
18
+ <field>sourcetype</field>
19
+ <field>splunk_server</field>
20
+ </fieldOrder>
21
+ </meta>
22
+ <messages>
23
+ <msg type="DEBUG">base lispy: [ AND index::_internal ]</msg>
24
+ <msg type="DEBUG">search context: user="admin", app="search", bs-pathname="/Users/fross/splunks/splunk-5.0.2/etc"</msg>
25
+ </messages>
26
+
27
+ <result offset='0'>
28
+ <field k='_bkt'>
29
+ <value><text>_internal~1~BC03CEFB-A9C5-4DF5-9D8D-2558AD6E6EA9</text></value>
30
+ </field>
31
+ <field k='_cd'>
32
+ <value><text>1:4419005</text></value>
33
+ </field>
34
+ <field k='_indextime'>
35
+ <value><text>1360608181</text></value>
36
+ </field>
37
+ <field k='_raw'><v xml:space='preserve' trunc='0'>02-11-2013 10:43:01.060 -0800 INFO Metrics - group=tpool, name=indexertpool, qsize=0, workers=6, qwork_units=0</v></field>
38
+ <field k='_serial'>
39
+ <value><text>0</text></value>
40
+ </field>
41
+ <field k='_si'>
42
+ <value><text>fross-mbp15.local</text></value>
43
+ <value><text>_internal</text></value>
44
+ </field>
45
+ <field k='_sourcetype'>
46
+ <value><text>splunkd</text></value>
47
+ </field>
48
+ <field k='_subsecond'>
49
+ <value><text>.060</text></value>
50
+ </field>
51
+ <field k='_time'>
52
+ <value><text>2013-02-11 10:43:01.060 PST</text></value>
53
+ </field>
54
+ <field k='host'>
55
+ <value><text>fross-mbp15.local</text></value>
56
+ </field>
57
+ <field k='index'>
58
+ <value h='1'><text>_internal</text></value>
59
+ </field>
60
+ <field k='linecount'>
61
+ <value><text>1</text></value>
62
+ </field>
63
+ <field k='source'>
64
+ <value><text>/Users/fross/splunks/splunk-5.0.2/var/log/splunk/metrics.log</text></value>
65
+ </field>
66
+ <field k='sourcetype'>
67
+ <value><text>splunkd</text></value>
68
+ </field>
69
+ <field k='splunk_server'>
70
+ <value><text>fross-mbp15.local</text></value>
71
+ </field>
72
+ </result>
73
+ <result offset='1'>
74
+ <field k='_bkt'>
75
+ <value><text>_internal~1~BC03CEFB-A9C5-4DF5-9D8D-2558AD6E6EA9</text></value>
76
+ </field>
77
+ <field k='_cd'>
78
+ <value><text>1:4418999</text></value>
79
+ </field>
80
+ <field k='_indextime'>
81
+ <value><text>1360608181</text></value>
82
+ </field>
83
+ <field k='_raw'><v xml:space='preserve' trunc='0'>02-11-2013 10:43:01.060 -0800 INFO Metrics - group=tpool, name=bundlereplthreadpool, qsize=0, workers=0, qwork_units=0</v></field>
84
+ <field k='_serial'>
85
+ <value><text>1</text></value>
86
+ </field>
87
+ <field k='_si'>
88
+ <value><text>fross-mbp15.local</text></value>
89
+ <value><text>_internal</text></value>
90
+ </field>
91
+ <field k='_sourcetype'>
92
+ <value><text>splunkd</text></value>
93
+ </field>
94
+ <field k='_subsecond'>
95
+ <value><text>.060</text></value>
96
+ </field>
97
+ <field k='_time'>
98
+ <value><text>2013-02-11 10:43:01.060 PST</text></value>
99
+ </field>
100
+ <field k='host'>
101
+ <value><text>fross-mbp15.local</text></value>
102
+ </field>
103
+ <field k='index'>
104
+ <value h='1'><text>_internal</text></value>
105
+ </field>
106
+ <field k='linecount'>
107
+ <value><text>1</text></value>
108
+ </field>
109
+ <field k='source'>
110
+ <value><text>/Users/fross/splunks/splunk-5.0.2/var/log/splunk/metrics.log</text></value>
111
+ </field>
112
+ <field k='sourcetype'>
113
+ <value><text>splunkd</text></value>
114
+ </field>
115
+ <field k='splunk_server'>
116
+ <value><text>fross-mbp15.local</text></value>
117
+ </field>
118
+ </result>
119
+ </results>
120
+ <results preview='0'>
121
+ <meta>
122
+ <fieldOrder>
123
+ <field>_bkt</field>
124
+ <field>_cd</field>
125
+ <field>_indextime</field>
126
+ <field>_raw</field>
127
+ <field>_serial</field>
128
+ <field>_si</field>
129
+ <field>_sourcetype</field>
130
+ <field>_subsecond</field>
131
+ <field>_time</field>
132
+ <field>host</field>
133
+ <field>index</field>
134
+ <field>linecount</field>
135
+ <field>source</field>
136
+ <field>sourcetype</field>
137
+ <field>splunk_server</field>
138
+ </fieldOrder>
139
+ </meta>
140
+ <result offset='0'>
141
+ <field k='_bkt'>
142
+ <value><text>_internal~1~BC03CEFB-A9C5-4DF5-9D8D-2558AD6E6EA9</text></value>
143
+ </field>
144
+ <field k='_cd'>
145
+ <value><text>1:4418632</text></value>
146
+ </field>
147
+ <field k='_indextime'>
148
+ <value><text>1360608170</text></value>
149
+ </field>
150
+ <field k='_raw'><v xml:space='preserve' trunc='0'>127.0.0.1 - admin [11/Feb/2013:10:42:49.790 -0800] &quot;POST /services/search/jobs/export HTTP/1.1&quot; 200 440404 - - - 257ms</v></field>
151
+ <field k='_serial'>
152
+ <value><text>51</text></value>
153
+ </field>
154
+ <field k='_si'>
155
+ <value><text>fross-mbp15.local</text></value>
156
+ <value><text>_internal</text></value>
157
+ </field>
158
+ <field k='_sourcetype'>
159
+ <value><text>splunkd_access</text></value>
160
+ </field>
161
+ <field k='_subsecond'>
162
+ <value><text>.790</text></value>
163
+ </field>
164
+ <field k='_time'>
165
+ <value><text>2013-02-11 10:42:49.790 PST</text></value>
166
+ </field>
167
+ <field k='host'>
168
+ <value><text>fross-mbp15.local</text></value>
169
+ </field>
170
+ <field k='index'>
171
+ <value h='1'><text>_internal</text></value>
172
+ </field>
173
+ <field k='linecount'>
174
+ <value><text>1</text></value>
175
+ </field>
176
+ <field k='source'>
177
+ <value><text>/Users/fross/splunks/splunk-5.0.2/var/log/splunk/splunkd_access.log</text></value>
178
+ </field>
179
+ <field k='sourcetype'>
180
+ <value><text>splunkd_access</text></value>
181
+ </field>
182
+ <field k='splunk_server'>
183
+ <value><text>fross-mbp15.local</text></value>
184
+ </field>
185
+ </result>
186
+ <result offset='1'>
187
+ <field k='_bkt'>
188
+ <value><text>_internal~1~BC03CEFB-A9C5-4DF5-9D8D-2558AD6E6EA9</text></value>
189
+ </field>
190
+ <field k='_cd'>
191
+ <value><text>1:4418626</text></value>
192
+ </field>
193
+ <field k='_indextime'>
194
+ <value><text>1360608157</text></value>
195
+ </field>
196
+ <field k='_raw'><v xml:space='preserve' trunc='0'>127.0.0.1 - admin [11/Feb/2013:10:42:36.527 -0800] &quot;POST /services/search/jobs/export HTTP/1.1&quot; 200 4937 - - - 219ms</v></field>
197
+ <field k='_serial'>
198
+ <value><text>52</text></value>
199
+ </field>
200
+ <field k='_si'>
201
+ <value><text>fross-mbp15.local</text></value>
202
+ <value><text>_internal</text></value>
203
+ </field>
204
+ <field k='_sourcetype'>
205
+ <value><text>splunkd_access</text></value>
206
+ </field>
207
+ <field k='_subsecond'>
208
+ <value><text>.527</text></value>
209
+ </field>
210
+ <field k='_time'>
211
+ <value><text>2013-02-11 10:42:36.527 PST</text></value>
212
+ </field>
213
+ <field k='host'>
214
+ <value><text>fross-mbp15.local</text></value>
215
+ </field>
216
+ <field k='index'>
217
+ <value h='1'><text>_internal</text></value>
218
+ </field>
219
+ <field k='linecount'>
220
+ <value><text>1</text></value>
221
+ </field>
222
+ <field k='source'>
223
+ <value><text>/Users/fross/splunks/splunk-5.0.2/var/log/splunk/splunkd_access.log</text></value>
224
+ </field>
225
+ <field k='sourcetype'>
226
+ <value><text>splunkd_access</text></value>
227
+ </field>
228
+ <field k='splunk_server'>
229
+ <value><text>fross-mbp15.local</text></value>
230
+ </field>
231
+ </result>
232
+ </results>