logstash-input-googleanalytics 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/DEVELOPER.md +2 -0
- data/Gemfile +2 -0
- data/LICENSE +13 -0
- data/NOTICE.TXT +5 -0
- data/README.md +94 -0
- data/lib/logstash/inputs/googleanalytics.rb +239 -0
- data/logstash-input-googleanalytics.gemspec +29 -0
- data/spec/inputs/googleanalytics_spec.rb +47 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '04491f6fbd0155db1436da6f0845bd63ce29636b7372b492de73763c56924ecc'
|
4
|
+
data.tar.gz: 7cb8556acc02f88b1eae332ddca42e0bc754723174069cba9afadec93629e865
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b51b990b31c66d14479e154e4581c3bea8897777a4f98633774c7e07e3a128b4969b8c19d91a80cd0f737e0e3020c657f9d107061d997921128e2f278eb76222
|
7
|
+
data.tar.gz: cb6eb9728d995f98fbedc7796cb645e58e1634cb6763940a05bc5d8ea89bd6b81e3c5dc8770f237f8c9cdd125841b5f64c5d8ab18a0fbdfdd5bd4a9b2a262962
|
data/CHANGELOG.md
ADDED
data/DEVELOPER.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/NOTICE.TXT
ADDED
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# Logstash Plugin
|
2
|
+
|
3
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
|
+
|
5
|
+
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
6
|
+
|
7
|
+
## SSL Errors
|
8
|
+
|
9
|
+
Sometimes you will get an SSL Error. It can easily be solved by following the advice [here](https://github.com/jruby/jruby/issues/1055#issuecomment-38209934) and adding a new cacert.pem to your environment.
|
10
|
+
```
|
11
|
+
Error: certificate verify failed
|
12
|
+
Exception: Faraday::SSLError
|
13
|
+
```
|
14
|
+
|
15
|
+
## Documentation
|
16
|
+
|
17
|
+
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
18
|
+
|
19
|
+
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
20
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
21
|
+
|
22
|
+
## Need Help?
|
23
|
+
|
24
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
25
|
+
|
26
|
+
## Developing
|
27
|
+
|
28
|
+
### 1. Plugin Developement and Testing
|
29
|
+
|
30
|
+
#### Code
|
31
|
+
- To get started, you'll need JRuby with the Bundler gem installed.
|
32
|
+
|
33
|
+
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
|
34
|
+
|
35
|
+
- Install dependencies
|
36
|
+
```sh
|
37
|
+
bundle install
|
38
|
+
```
|
39
|
+
|
40
|
+
#### Test
|
41
|
+
|
42
|
+
- Update your dependencies
|
43
|
+
|
44
|
+
```sh
|
45
|
+
bundle install
|
46
|
+
```
|
47
|
+
|
48
|
+
- Run tests
|
49
|
+
|
50
|
+
```sh
|
51
|
+
bundle exec rspec
|
52
|
+
```
|
53
|
+
|
54
|
+
### 2. Running your unpublished Plugin in Logstash
|
55
|
+
|
56
|
+
#### 2.1 Run in a local Logstash clone
|
57
|
+
|
58
|
+
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
59
|
+
```ruby
|
60
|
+
gem "logstash-input-googleanalytics", :path => "/your/local/logstash-input-googleanalytics"
|
61
|
+
```
|
62
|
+
- Install plugin
|
63
|
+
```sh
|
64
|
+
bin/plugin install --no-verify
|
65
|
+
```
|
66
|
+
- Run Logstash with your plugin
|
67
|
+
```sh
|
68
|
+
bin/logstash -e 'filter {awesome {}}'
|
69
|
+
```
|
70
|
+
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
71
|
+
|
72
|
+
#### 2.2 Run in an installed Logstash
|
73
|
+
|
74
|
+
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
|
75
|
+
|
76
|
+
- Build your plugin gem
|
77
|
+
```sh
|
78
|
+
gem build logstash-filter-awesome.gemspec
|
79
|
+
```
|
80
|
+
- Install the plugin from the Logstash home
|
81
|
+
```sh
|
82
|
+
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
|
83
|
+
```
|
84
|
+
- Start Logstash and proceed to test the plugin
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
|
88
|
+
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
89
|
+
|
90
|
+
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
91
|
+
|
92
|
+
It is more important to the community that you are able to contribute.
|
93
|
+
|
94
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -0,0 +1,239 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/inputs/base"
|
3
|
+
require "logstash/namespace"
|
4
|
+
require "stud/interval"
|
5
|
+
|
6
|
+
# Generate a repeating message.
|
7
|
+
#
|
8
|
+
# This plugin is intented only as an example.
|
9
|
+
|
10
|
+
class LogStash::Inputs::GoogleAnalytics < LogStash::Inputs::Base
|
11
|
+
config_name "googleanalytics"
|
12
|
+
|
13
|
+
# If undefined, Logstash will complain, even if codec is unused.
|
14
|
+
default :codec, "plain"
|
15
|
+
|
16
|
+
# Most of these inputs are described in the Google Analytics API docs.
|
17
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#q_details
|
18
|
+
# Any changes from the format described above have been noted.
|
19
|
+
|
20
|
+
# Type for logstash filtering
|
21
|
+
config :type, :validate => :string, :default => 'googleanalytics'
|
22
|
+
# A comma separated list of view (profile) ids, in the format 'ga:XXXX'
|
23
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#ids
|
24
|
+
config :ids, :validate => :string, :required => true
|
25
|
+
# In the format YYYY-MM-DD, or relative by using today, yesterday, or the NdaysAgo pattern
|
26
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#startDate
|
27
|
+
config :start_date, :validate => :string, :default => 'yesterday'
|
28
|
+
# In the format YYYY-MM-DD, or relative by using today, yesterday, or the NdaysAgo pattern
|
29
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#endDate
|
30
|
+
config :end_date, :validate => :string, :default => 'yesterday'
|
31
|
+
# The aggregated statistics for user activity to your site, such as clicks or pageviews.
|
32
|
+
# Maximum of 10 metrics for any query
|
33
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#metrics
|
34
|
+
# For a full list of metrics, see the documentation
|
35
|
+
# https://developers.google.com/analytics/devguides/reporting/core/dimsmets
|
36
|
+
config :metrics, :validate => :string, :required => true
|
37
|
+
# Breaks down metrics by common criteria; for example, by ga:browser or ga:city
|
38
|
+
# Maximum of 7 dimensions in any query
|
39
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#dimensions
|
40
|
+
# For a full list of dimensions, see the documentation
|
41
|
+
# https://developers.google.com/analytics/devguides/reporting/core/dimsmets
|
42
|
+
config :dimensions, :validate => :string, :default => nil
|
43
|
+
# Used to restrict the data returned from your request
|
44
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters
|
45
|
+
config :filters, :validate => :string, :default => nil
|
46
|
+
# A list of metrics and dimensions indicating the sorting order and sorting direction for the returned data
|
47
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#sort
|
48
|
+
config :sort, :validate => :string, :default => nil
|
49
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment
|
50
|
+
config :segment, :validate => :string, :default => nil
|
51
|
+
# Valid values are DEFAULT, FASTER, HIGHER_PRECISION
|
52
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#samplingLevel
|
53
|
+
config :sampling_level, :validate => :string, :default => nil
|
54
|
+
# This is the result to start with, beginning at 1
|
55
|
+
# You probably don't need to change this but it has been included here for completeness
|
56
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#startIndex
|
57
|
+
config :start_index, :validate => :number, :default => 1
|
58
|
+
# This is the number of results in a page. This plugin will start at
|
59
|
+
# @start_index and keep pulling pages of data until it has all results.
|
60
|
+
# You probably don't need to change this but it has been included here for completeness
|
61
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#maxResults
|
62
|
+
config :max_results, :validate => :number, :default => 10000
|
63
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#include-empty-rows
|
64
|
+
config :include_empty_rows, :validate => :boolean, :default => true
|
65
|
+
|
66
|
+
# These values need to be pulled from your Google Developers Console
|
67
|
+
# For more information, see the docs. Be sure to enable Google Analytics API
|
68
|
+
# access for your application.
|
69
|
+
# https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
70
|
+
|
71
|
+
# This should be the path to the public/private key as a standard P12 file
|
72
|
+
config :key_file_path, :validate => :string, :required => true
|
73
|
+
# The key secret doe the file above. If not prompted for a secret,
|
74
|
+
# it seems to default to notasecret
|
75
|
+
config :key_secret, :validate => :string, :default => 'notasecret'
|
76
|
+
# The service email account found in the Google Developers Console after
|
77
|
+
# generating the key file.
|
78
|
+
config :service_account_email, :validate => :string, :required => true
|
79
|
+
|
80
|
+
# The service name to connect to. Should not change unless Google changes something
|
81
|
+
config :service_name, :validate => :string, :default => 'analytics'
|
82
|
+
# The version of the API to use.
|
83
|
+
config :api_version, :validate => :string, :default => 'v3'
|
84
|
+
|
85
|
+
# This will store the query in the resulting logstash event
|
86
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#data_response
|
87
|
+
config :store_query, :validate => :boolean, :default => true
|
88
|
+
# This will store the profile information in the resulting logstash event
|
89
|
+
# https://developers.google.com/analytics/devguides/reporting/core/v3/reference#data_response
|
90
|
+
config :store_profile, :validate => :boolean, :default => true
|
91
|
+
|
92
|
+
# Interval to run the command. Value is in seconds. If no interval is given,
|
93
|
+
# this plugin only fetches data once.
|
94
|
+
config :interval, :validate => :number, :required => false
|
95
|
+
|
96
|
+
|
97
|
+
public
|
98
|
+
def register
|
99
|
+
require 'google/api_client'
|
100
|
+
end # def register
|
101
|
+
|
102
|
+
def run(queue)
|
103
|
+
# we can abort the loop if stop? becomes true
|
104
|
+
while !stop?
|
105
|
+
start = Time.now
|
106
|
+
client, analytics = get_service
|
107
|
+
results_index = @start_index
|
108
|
+
while !stop?
|
109
|
+
results = client.execute(
|
110
|
+
:api_method => analytics.data.ga.get,
|
111
|
+
:parameters => client_options(results_index))
|
112
|
+
|
113
|
+
if results.data.rows.first
|
114
|
+
query = results.data.query.to_hash
|
115
|
+
profile_info = results.data.profile_info.to_hash
|
116
|
+
column_headers = results.data.column_headers.map { |c|
|
117
|
+
c.name
|
118
|
+
}
|
119
|
+
|
120
|
+
results.data.rows.each do |r|
|
121
|
+
event = LogStash::Event.new()
|
122
|
+
decorate(event)
|
123
|
+
event['containsSampledData'] = results.data.containsSampledData
|
124
|
+
event['query'] = query if @store_query
|
125
|
+
event['profileInfo'] = profile_info if @store_profile
|
126
|
+
column_headers.zip(r).each do |head,data|
|
127
|
+
if is_num(data)
|
128
|
+
float_data = Float(data)
|
129
|
+
# Sometimes GA returns infinity. if so, the number it invalid
|
130
|
+
# so set it to zero.
|
131
|
+
if float_data == Float::INFINITY
|
132
|
+
event[head.gsub(':','_')] = 0.0
|
133
|
+
else
|
134
|
+
event[head.gsub(':','_')] = float_data
|
135
|
+
end
|
136
|
+
else
|
137
|
+
event[head.gsub(':','_')] = data
|
138
|
+
end
|
139
|
+
end
|
140
|
+
# Try to add a date unless it was already added
|
141
|
+
if @start_date == @end_date
|
142
|
+
if !event.include?('ga_date')
|
143
|
+
if @start_date == 'today'
|
144
|
+
event['ga_date'] = Date.parse(Time.now().strftime("%F"))
|
145
|
+
elsif @start_date == 'yesterday'
|
146
|
+
event['ga_date'] = Date.parse(Time.at(Time.now.to_i - 86400).strftime("%F"))
|
147
|
+
elsif @start_date.include?('daysAgo')
|
148
|
+
days_ago = @start_date.sub('daysAgo','').to_i
|
149
|
+
event['ga_date'] = Date.parse(Time.at(Time.now.to_i - (days_ago*86400)).strftime("%F"))
|
150
|
+
else
|
151
|
+
event['ga_date'] = Date.parse(@start_date)
|
152
|
+
end
|
153
|
+
else
|
154
|
+
event['ga_date'] = Date.parse(event['ga_date'].to_i.to_s)
|
155
|
+
end
|
156
|
+
else
|
157
|
+
# Convert YYYYMMdd to YYYY-MM-dd
|
158
|
+
event['ga_date'] = Date.parse(event['ga_date'].to_i.to_s)
|
159
|
+
end
|
160
|
+
event['ga_date'] = event['ga_date'].to_s
|
161
|
+
queue << event
|
162
|
+
end
|
163
|
+
end
|
164
|
+
nextLink = results.data.nextLink rescue nil
|
165
|
+
if nextLink
|
166
|
+
start_index+=@max_results
|
167
|
+
else
|
168
|
+
break
|
169
|
+
end
|
170
|
+
end
|
171
|
+
if @interval.nil?
|
172
|
+
break
|
173
|
+
else
|
174
|
+
duration = Time.now - start
|
175
|
+
# Sleep for the remainder of the interval, or 0 if the duration ran
|
176
|
+
# longer than the interval.
|
177
|
+
sleeptime = [0, @interval - duration].max
|
178
|
+
if sleeptime == 0
|
179
|
+
@logger.warn("Execution ran longer than the interval. Skipping sleep.",
|
180
|
+
:duration => duration,
|
181
|
+
:interval => @interval)
|
182
|
+
else
|
183
|
+
Stud.stoppable_sleep(sleeptime) { stop? }
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end # loop
|
187
|
+
end # def run
|
188
|
+
|
189
|
+
def stop
|
190
|
+
end
|
191
|
+
|
192
|
+
private
|
193
|
+
def client_options(results_index)
|
194
|
+
options = {
|
195
|
+
'ids' => @ids,
|
196
|
+
'start-date' => @start_date,
|
197
|
+
'end-date' => @end_date,
|
198
|
+
'metrics' => @metrics,
|
199
|
+
'max-results' => @max_results,
|
200
|
+
'output' => 'json',
|
201
|
+
'start-index' => results_index
|
202
|
+
}
|
203
|
+
options.merge!({ 'dimensions' => @dimensions }) if @dimensions
|
204
|
+
options.merge!({ 'filters' => @filters }) if @filters
|
205
|
+
options.merge!({ 'sort' => @sort }) if @sort
|
206
|
+
options.merge!({ 'segment' => @segment }) if @segment
|
207
|
+
options.merge!({ 'samplingLevel' => @sampling_level }) if @sampling_level
|
208
|
+
options.merge!({ 'include-empty-rows' => @include_empty_rows }) if !@include_empty_rows.nil?
|
209
|
+
return options
|
210
|
+
end
|
211
|
+
|
212
|
+
def get_service
|
213
|
+
client = Google::APIClient.new(
|
214
|
+
:application_name => 'Google Analytics Logstash Input',
|
215
|
+
:application_version => '1.0.0')
|
216
|
+
|
217
|
+
puts @key_file_path
|
218
|
+
puts @key_secret
|
219
|
+
puts @service_account_email
|
220
|
+
# Load our credentials for the service account
|
221
|
+
key = Google::APIClient::KeyUtils.load_from_pkcs12(@key_file_path, @key_secret)
|
222
|
+
client.authorization = Signet::OAuth2::Client.new(
|
223
|
+
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
|
224
|
+
:audience => 'https://accounts.google.com/o/oauth2/token',
|
225
|
+
:scope => 'https://www.googleapis.com/auth/analytics.readonly',
|
226
|
+
:issuer => @service_account_email,
|
227
|
+
:signing_key => key)
|
228
|
+
|
229
|
+
# Request a token for our service account
|
230
|
+
client.authorization.fetch_access_token!
|
231
|
+
analytics = client.discovered_api(@service_name, @api_version)
|
232
|
+
return client, analytics
|
233
|
+
end
|
234
|
+
|
235
|
+
private
|
236
|
+
def is_num(a)
|
237
|
+
return (Float(a) and true) rescue false
|
238
|
+
end
|
239
|
+
end # class LogStash::Inputs::GoogleAnalytics
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-input-googleanalytics'
|
3
|
+
s.version = '1.0.0'
|
4
|
+
s.licenses = ['Apache License (2.0)']
|
5
|
+
s.summary = "This input queries the Google Analytics API at a definable interval."
|
6
|
+
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
7
|
+
s.authors = ["Elastic","Russ Savage"]
|
8
|
+
s.email = 'russ@elastic.co'
|
9
|
+
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
|
12
|
+
# Files
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
14
|
+
# Tests
|
15
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
|
+
|
17
|
+
# Special flag to let us know this is actually a logstash plugin
|
18
|
+
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
19
|
+
|
20
|
+
# Gem dependencies
|
21
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
22
|
+
s.add_development_dependency 'logstash-devutils'
|
23
|
+
s.add_runtime_dependency 'logstash-codec-plain'
|
24
|
+
s.add_runtime_dependency 'stud', '>= 0.0.22'
|
25
|
+
s.add_runtime_dependency 'google-api-client', "~> 0.7.1"
|
26
|
+
s.add_development_dependency 'vcr'
|
27
|
+
s.add_development_dependency 'webmock'
|
28
|
+
s.add_development_dependency 'json'
|
29
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/devutils/rspec/spec_helper"
|
3
|
+
require "logstash/inputs/googleanalytics"
|
4
|
+
require "vcr"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
ENV['SSL_CERT_FILE'] = "/Users/rsavage/Downloads/cacert.pem"
|
8
|
+
|
9
|
+
VCR.configure do |config|
|
10
|
+
config.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes')
|
11
|
+
config.hook_into :webmock
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.describe LogStash::Inputs::GoogleAnalytics do
|
15
|
+
describe "inputs/googleanalytics" do
|
16
|
+
context "get audience overview" do
|
17
|
+
let(:options) do
|
18
|
+
{
|
19
|
+
'ids' => 'ga:97869209',
|
20
|
+
'start_date' => '27daysAgo',
|
21
|
+
'end_date' => '27daysAgo',
|
22
|
+
'metrics' => 'ga:pageviews',
|
23
|
+
'dimensions' => 'ga:date',
|
24
|
+
'key_file_path' => '/Users/rsavage/workspace/logstash-1.4.2/logstash-input-googleanalytics-1c933e55eca6.p12',
|
25
|
+
'key_secret' => 'notasecret',
|
26
|
+
'service_account_email' => '759646568999-hto359j2lud906ae7ufts01djuu0n7j0@developer.gserviceaccount.com'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
let(:input) { LogStash::Inputs::GoogleAnalytics.new(options) }
|
30
|
+
let(:expected_fields_result) { ["ga_pageviews"] }
|
31
|
+
let(:queue) { [] }
|
32
|
+
subject { input }
|
33
|
+
it "loads pageviews" do
|
34
|
+
#VCR.use_cassette("get_audience_overview") do
|
35
|
+
subject.register
|
36
|
+
subject.run(queue)
|
37
|
+
expect(queue.length).to eq(1)
|
38
|
+
e = queue.pop
|
39
|
+
expected_fields_result.each do |f|
|
40
|
+
expect(e.to_hash).to include(f)
|
41
|
+
end
|
42
|
+
#end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-input-googleanalytics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elastic
|
8
|
+
- Russ Savage
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: logstash-core-plugin-api
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.60'
|
21
|
+
- - "<="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '2.99'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.60'
|
31
|
+
- - "<="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.99'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: logstash-devutils
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: logstash-codec-plain
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: stud
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.22
|
69
|
+
type: :runtime
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.0.22
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: google-api-client
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.7.1
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.7.1
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: vcr
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: webmock
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: json
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
description: This gem is a logstash plugin required to be installed on top of the
|
133
|
+
Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
|
134
|
+
a stand-alone program
|
135
|
+
email: russ@elastic.co
|
136
|
+
executables: []
|
137
|
+
extensions: []
|
138
|
+
extra_rdoc_files: []
|
139
|
+
files:
|
140
|
+
- CHANGELOG.md
|
141
|
+
- DEVELOPER.md
|
142
|
+
- Gemfile
|
143
|
+
- LICENSE
|
144
|
+
- NOTICE.TXT
|
145
|
+
- README.md
|
146
|
+
- lib/logstash/inputs/googleanalytics.rb
|
147
|
+
- logstash-input-googleanalytics.gemspec
|
148
|
+
- spec/inputs/googleanalytics_spec.rb
|
149
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
150
|
+
licenses:
|
151
|
+
- Apache License (2.0)
|
152
|
+
metadata:
|
153
|
+
logstash_plugin: 'true'
|
154
|
+
logstash_group: input
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubygems_version: 3.1.2
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: This input queries the Google Analytics API at a definable interval.
|
174
|
+
test_files:
|
175
|
+
- spec/inputs/googleanalytics_spec.rb
|