vmik-fluent-plugin-google-cloud 0.5.5.alpha1
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.
- data/CONTRIBUTING +24 -0
- data/Gemfile +3 -0
- data/LICENSE +201 -0
- data/README.rdoc +46 -0
- data/Rakefile +42 -0
- data/fluent-plugin-google-cloud.gemspec +34 -0
- data/lib/fluent/plugin/out_google_cloud.rb +1184 -0
- data/lib/google/logging/type/http_request_pb.rb +30 -0
- data/lib/google/logging/type/log_severity_pb.rb +26 -0
- data/lib/google/logging/v1/log_entry_pb.rb +52 -0
- data/lib/google/logging/v1/logging_pb.rb +84 -0
- data/lib/google/logging/v1/logging_services_pb.rb +150 -0
- data/test/helper.rb +40 -0
- data/test/plugin/base_test.rb +1534 -0
- data/test/plugin/data/c31e573fd7f62ed495c9ca3821a5a85cb036dee1-privatekey.p12 +0 -0
- data/test/plugin/data/credentials.json +7 -0
- data/test/plugin/data/iam-credentials.json +11 -0
- data/test/plugin/data/invalid_credentials.json +8 -0
- data/test/plugin/test_out_google_cloud.rb +297 -0
- data/test/plugin/test_out_google_cloud_grpc.rb +381 -0
- data/vmik-fluent-plugin-google-cloud-0.5.5.gem +0 -0
- metadata +291 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/logging/type/http_request.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_message "google.logging.type.HttpRequest" do
|
8
|
+
optional :request_method, :string, 1
|
9
|
+
optional :request_url, :string, 2
|
10
|
+
optional :request_size, :int64, 3
|
11
|
+
optional :status, :int32, 4
|
12
|
+
optional :response_size, :int64, 5
|
13
|
+
optional :user_agent, :string, 6
|
14
|
+
optional :remote_ip, :string, 7
|
15
|
+
optional :server_ip, :string, 13
|
16
|
+
optional :referer, :string, 8
|
17
|
+
optional :cache_lookup, :bool, 11
|
18
|
+
optional :cache_hit, :bool, 9
|
19
|
+
optional :cache_validated_with_origin_server, :bool, 10
|
20
|
+
optional :cache_fill_bytes, :int64, 12
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Logging
|
26
|
+
module Type
|
27
|
+
HttpRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.type.HttpRequest").msgclass
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/logging/type/log_severity.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_enum "google.logging.type.LogSeverity" do
|
8
|
+
value :DEFAULT, 0
|
9
|
+
value :DEBUG, 100
|
10
|
+
value :INFO, 200
|
11
|
+
value :NOTICE, 300
|
12
|
+
value :WARNING, 400
|
13
|
+
value :ERROR, 500
|
14
|
+
value :CRITICAL, 600
|
15
|
+
value :ALERT, 700
|
16
|
+
value :EMERGENCY, 800
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Logging
|
22
|
+
module Type
|
23
|
+
LogSeverity = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.type.LogSeverity").enummodule
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/logging/v1/log_entry.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/logging/type/http_request_pb'
|
7
|
+
require 'google/logging/type/log_severity_pb'
|
8
|
+
require 'google/protobuf/any_pb'
|
9
|
+
require 'google/protobuf/struct_pb'
|
10
|
+
require 'google/protobuf/timestamp_pb'
|
11
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
|
+
add_message "google.logging.v1.LogEntry" do
|
13
|
+
optional :metadata, :message, 1, "google.logging.v1.LogEntryMetadata"
|
14
|
+
optional :insert_id, :string, 4
|
15
|
+
optional :log, :string, 5
|
16
|
+
optional :http_request, :message, 7, "google.logging.type.HttpRequest"
|
17
|
+
optional :operation, :message, 8, "google.logging.v1.LogEntryOperation"
|
18
|
+
optional :writer_email_address, :string, 9
|
19
|
+
oneof :payload do
|
20
|
+
optional :proto_payload, :message, 2, "google.protobuf.Any"
|
21
|
+
optional :text_payload, :string, 3
|
22
|
+
optional :struct_payload, :message, 6, "google.protobuf.Struct"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
add_message "google.logging.v1.LogEntryMetadata" do
|
26
|
+
optional :timestamp, :message, 9, "google.protobuf.Timestamp"
|
27
|
+
optional :severity, :enum, 2, "google.logging.type.LogSeverity"
|
28
|
+
optional :project_id, :string, 3
|
29
|
+
optional :project_number, :int64, 10
|
30
|
+
optional :service_name, :string, 4
|
31
|
+
optional :region, :string, 5
|
32
|
+
optional :zone, :string, 6
|
33
|
+
optional :user_id, :string, 7
|
34
|
+
map :labels, :string, :string, 8
|
35
|
+
end
|
36
|
+
add_message "google.logging.v1.LogEntryOperation" do
|
37
|
+
optional :id, :string, 1
|
38
|
+
optional :producer, :string, 2
|
39
|
+
optional :first, :bool, 3
|
40
|
+
optional :last, :bool, 4
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Google
|
45
|
+
module Logging
|
46
|
+
module V1
|
47
|
+
LogEntry = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.LogEntry").msgclass
|
48
|
+
LogEntryMetadata = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.LogEntryMetadata").msgclass
|
49
|
+
LogEntryOperation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.LogEntryOperation").msgclass
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/logging/v1/logging.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/logging/v1/log_entry_pb'
|
7
|
+
require 'google/protobuf/empty_pb'
|
8
|
+
require 'google/protobuf/timestamp_pb'
|
9
|
+
require 'google/rpc/status_pb'
|
10
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
11
|
+
add_message "google.logging.v1.Log" do
|
12
|
+
optional :name, :string, 1
|
13
|
+
optional :display_name, :string, 2
|
14
|
+
optional :payload_type, :string, 3
|
15
|
+
end
|
16
|
+
add_message "google.logging.v1.LogService" do
|
17
|
+
optional :name, :string, 1
|
18
|
+
repeated :index_keys, :string, 2
|
19
|
+
end
|
20
|
+
add_message "google.logging.v1.ListLogsRequest" do
|
21
|
+
optional :project_name, :string, 1
|
22
|
+
optional :service_name, :string, 4
|
23
|
+
optional :service_index_prefix, :string, 5
|
24
|
+
optional :page_size, :int32, 2
|
25
|
+
optional :page_token, :string, 3
|
26
|
+
end
|
27
|
+
add_message "google.logging.v1.ListLogsResponse" do
|
28
|
+
repeated :logs, :message, 1, "google.logging.v1.Log"
|
29
|
+
optional :next_page_token, :string, 2
|
30
|
+
end
|
31
|
+
add_message "google.logging.v1.DeleteLogRequest" do
|
32
|
+
optional :log_name, :string, 1
|
33
|
+
end
|
34
|
+
add_message "google.logging.v1.WriteLogEntriesRequest" do
|
35
|
+
optional :log_name, :string, 1
|
36
|
+
map :common_labels, :string, :string, 3
|
37
|
+
repeated :entries, :message, 4, "google.logging.v1.LogEntry"
|
38
|
+
optional :partial_success, :bool, 5
|
39
|
+
end
|
40
|
+
add_message "google.logging.v1.WriteLogEntriesResponse" do
|
41
|
+
end
|
42
|
+
add_message "google.logging.v1.WriteLogEntriesPartialErrors" do
|
43
|
+
map :log_entry_errors, :int32, :message, 1, "google.rpc.Status"
|
44
|
+
end
|
45
|
+
add_message "google.logging.v1.ListLogServicesRequest" do
|
46
|
+
optional :project_name, :string, 1
|
47
|
+
optional :page_size, :int32, 3
|
48
|
+
optional :page_token, :string, 4
|
49
|
+
end
|
50
|
+
add_message "google.logging.v1.ListLogServicesResponse" do
|
51
|
+
repeated :log_services, :message, 1, "google.logging.v1.LogService"
|
52
|
+
optional :next_page_token, :string, 2
|
53
|
+
end
|
54
|
+
add_message "google.logging.v1.ListLogServiceIndexesRequest" do
|
55
|
+
optional :service_name, :string, 1
|
56
|
+
optional :index_prefix, :string, 2
|
57
|
+
optional :depth, :int32, 3
|
58
|
+
optional :page_size, :int32, 5
|
59
|
+
optional :page_token, :string, 6
|
60
|
+
end
|
61
|
+
add_message "google.logging.v1.ListLogServiceIndexesResponse" do
|
62
|
+
repeated :service_index_prefixes, :string, 1
|
63
|
+
optional :next_page_token, :string, 2
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
module Google
|
68
|
+
module Logging
|
69
|
+
module V1
|
70
|
+
Log = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.Log").msgclass
|
71
|
+
LogService = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.LogService").msgclass
|
72
|
+
ListLogsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogsRequest").msgclass
|
73
|
+
ListLogsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogsResponse").msgclass
|
74
|
+
DeleteLogRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.DeleteLogRequest").msgclass
|
75
|
+
WriteLogEntriesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.WriteLogEntriesRequest").msgclass
|
76
|
+
WriteLogEntriesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.WriteLogEntriesResponse").msgclass
|
77
|
+
WriteLogEntriesPartialErrors = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.WriteLogEntriesPartialErrors").msgclass
|
78
|
+
ListLogServicesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogServicesRequest").msgclass
|
79
|
+
ListLogServicesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogServicesResponse").msgclass
|
80
|
+
ListLogServiceIndexesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogServiceIndexesRequest").msgclass
|
81
|
+
ListLogServiceIndexesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v1.ListLogServiceIndexesResponse").msgclass
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/logging/v1/logging.proto for package 'google.logging.v1'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'google/logging/v1/logging_pb'
|
6
|
+
|
7
|
+
module Google
|
8
|
+
module Logging
|
9
|
+
module V1
|
10
|
+
module LoggingService
|
11
|
+
# API Overview
|
12
|
+
# ------------
|
13
|
+
#
|
14
|
+
# The Logging service provides methods to manage (create/update/delete) logs,
|
15
|
+
# ingest and retrieve log entries within a log, and manage log sinks.
|
16
|
+
#
|
17
|
+
# Data Model
|
18
|
+
# ----------
|
19
|
+
#
|
20
|
+
# The Logging service exposes the following resources:
|
21
|
+
#
|
22
|
+
# * Projects, named `/projects/`
|
23
|
+
# These are Google Developers Console projects.
|
24
|
+
#
|
25
|
+
# * Project sinks, named as `/projects/*/sinks/*`
|
26
|
+
# These are additional destinations for the log entries written to a log.
|
27
|
+
# Log entries are written to each of the sinks in addition to the default
|
28
|
+
# built-in storage. Log entries are written to all of the matching sinks.
|
29
|
+
# Adding or removing a sink only affects log entries written after
|
30
|
+
# the operation on the sink completes.
|
31
|
+
#
|
32
|
+
# * Logs, named `/projects/*/logs/*`
|
33
|
+
# These are log resources associated with a given project. Logs whose name
|
34
|
+
# begins with a valid DNS name followed by a "/" are reserved for services that
|
35
|
+
# own the DNS name. For example, all logs that begin with
|
36
|
+
# `compute.googleapis.com/` are reserved for Google Compute Engine.
|
37
|
+
# Log names must be less than 512 characters long and can include the following
|
38
|
+
# characters:
|
39
|
+
# upper- and lower-case alphanumeric characters: [A-Za-z0-9]
|
40
|
+
# punctuation characters: slash, underscore, hyphen, period [/_-.]
|
41
|
+
#
|
42
|
+
# Note that when assembling the full log resource name, slashes in the trailing
|
43
|
+
# part of the name must be URL-encoded. For example, the full resource name for
|
44
|
+
# the log `compute.googleapis.com/syslog` in the `myproject` project would be
|
45
|
+
# `/projects/myproject/logs/compute.googleapis.com%2Fsyslog`.
|
46
|
+
#
|
47
|
+
# * Log entries, named as `/projects/*/logs/*/entries`
|
48
|
+
# These are individual log entries inside a log. NOTE: due to the potentially
|
49
|
+
# high traffic load for a log, the service does not assign resource names to
|
50
|
+
# individual log entries. The only way to retrieve log entries is to search
|
51
|
+
# through a log based on timestamp or other properties. All log entries in a
|
52
|
+
# log must have the same payload type.
|
53
|
+
#
|
54
|
+
# * Log sinks, named as `/projects/*/logs/*/sinks/*`
|
55
|
+
# These are additional destinations for the log entries written to a log.
|
56
|
+
# Log entries are written to each of the sinks in addition to the default
|
57
|
+
# built-in storage. Log entries are written to all of the matching sinks.
|
58
|
+
# Adding or removing a sink only affects log entries
|
59
|
+
# written after the operation on the sink completes.
|
60
|
+
#
|
61
|
+
# * Log services, named `/projects/*/logServices`
|
62
|
+
# These are cloud services that have ingested log entries for individual
|
63
|
+
# projects. Log entries may optionally be associated with a service at the
|
64
|
+
# time of ingestion. Log entries associated with a Google Cloud Platform
|
65
|
+
# service are indexed by labels specific to that service (see Service indexes
|
66
|
+
# below).
|
67
|
+
#
|
68
|
+
# * Log service sinks, named as `/projects/*/logServices/*/sinks/*`
|
69
|
+
# These are additional destinations for the log entries that are associated
|
70
|
+
# with a service. Log entries are written to each of the enabled sinks in
|
71
|
+
# addition to the default built-in storage. Log entries are written to all
|
72
|
+
# of the matching sinks. Adding or removing a sink only affects log entries
|
73
|
+
# written after the operation on the sink completes.
|
74
|
+
#
|
75
|
+
# * Log service indexes, named `/projects/*/logServices/*/indexes`
|
76
|
+
# These are descriptions of how the logging service indexes log entries
|
77
|
+
# associated with Google Cloud Platform services. Each index is a hierarchy of
|
78
|
+
# label values, which provides a guide as to how the log entries may be
|
79
|
+
# effectively filtered during retrieval. The corresponding label keys are
|
80
|
+
# associated with the log service resource. For example the App Engine service
|
81
|
+
# index is comprised of module and version identifiers, and one value might be
|
82
|
+
# "/myModule/myVersion/". See the documentation for
|
83
|
+
# [LogEntryMetadata.labels][google.logging.v1.LogEntryMetadata.labels] for
|
84
|
+
# details about relevant label keys for existing services.
|
85
|
+
#
|
86
|
+
# * Log metrics, named as `/projects/*/metrics/*`
|
87
|
+
# These are metric filters associated with a given project. A metric filter
|
88
|
+
# counts log entries that match a user-specified filter, and exports the count
|
89
|
+
# as a monitoring metric.
|
90
|
+
#
|
91
|
+
# Service for ingesting and querying logs.
|
92
|
+
class Service
|
93
|
+
|
94
|
+
include GRPC::GenericService
|
95
|
+
|
96
|
+
self.marshal_class_method = :encode
|
97
|
+
self.unmarshal_class_method = :decode
|
98
|
+
self.service_name = 'google.logging.v1.LoggingService'
|
99
|
+
|
100
|
+
# Log resources
|
101
|
+
# -------------
|
102
|
+
#
|
103
|
+
# There is no CreateLog operation, because calling WriteLogEntries
|
104
|
+
# on a nonexistent log automatically creates the log.
|
105
|
+
#
|
106
|
+
# Lists the logs in the project.
|
107
|
+
# Only logs that have entries are listed.
|
108
|
+
#
|
109
|
+
# (-- Requires https://www.googleapis.com/auth/logging.read scope. --)
|
110
|
+
rpc :ListLogs, ListLogsRequest, ListLogsResponse
|
111
|
+
# Deletes a log and all its log entries.
|
112
|
+
# The log will reappear if it receives new entries.
|
113
|
+
#
|
114
|
+
# (-- Requires https://www.googleapis.com/auth/logging.admin scope. --)
|
115
|
+
rpc :DeleteLog, DeleteLogRequest, Google::Protobuf::Empty
|
116
|
+
# Log entry resources
|
117
|
+
# -------------------
|
118
|
+
#
|
119
|
+
# Writes log entries to Stackdriver Logging. Each entry consists of a
|
120
|
+
# `LogEntry` object. You must fill in the required fields of the
|
121
|
+
# object. You can supply a map, `commonLabels`, that holds default
|
122
|
+
# (key, value) data for the `entries[].metadata.labels` map in each
|
123
|
+
# entry, saving you the trouble of creating identical copies for
|
124
|
+
# each entry.
|
125
|
+
#
|
126
|
+
# (-- Requires https://www.googleapis.com/auth/logging.write scope. --)
|
127
|
+
#
|
128
|
+
# (-- Google internal users may write batches of entries for multiple
|
129
|
+
# projects by setting the LogEntryMetadata.project_number for each entry and
|
130
|
+
# using '-' to identify the project in WriteLogEntriesRequest.log_name (for
|
131
|
+
# example, /projects/-/logs/log_name/entries:write). --)
|
132
|
+
rpc :WriteLogEntries, WriteLogEntriesRequest, WriteLogEntriesResponse
|
133
|
+
# Log service resources
|
134
|
+
# ---------------------
|
135
|
+
#
|
136
|
+
# Lists the log services that have log entries in this project.
|
137
|
+
#
|
138
|
+
# (-- Requires https://www.googleapis.com/auth/logging.read scope. --)
|
139
|
+
rpc :ListLogServices, ListLogServicesRequest, ListLogServicesResponse
|
140
|
+
# Lists the current index values for a log service.
|
141
|
+
#
|
142
|
+
# (-- Requires https://www.googleapis.com/auth/logging.read scope. --)
|
143
|
+
rpc :ListLogServiceIndexes, ListLogServiceIndexesRequest, ListLogServiceIndexesResponse
|
144
|
+
end
|
145
|
+
|
146
|
+
Stub = Service.rpc_stub_class
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright 2014 Google Inc. All rights reserved.
|
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.
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'bundler'
|
17
|
+
begin
|
18
|
+
Bundler.setup(:default, :development)
|
19
|
+
rescue Bundler::BundlerError => e
|
20
|
+
$stderr.puts e.message
|
21
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
22
|
+
exit e.status_code
|
23
|
+
end
|
24
|
+
require 'test/unit'
|
25
|
+
|
26
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
27
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
28
|
+
require 'fluent/test'
|
29
|
+
unless ENV.key?('VERBOSE')
|
30
|
+
nulllogger = Object.new
|
31
|
+
nulllogger.instance_eval do |_|
|
32
|
+
def method_missing(_method, *_args)
|
33
|
+
# pass
|
34
|
+
end
|
35
|
+
end
|
36
|
+
# global $log variable is used by fluentd
|
37
|
+
$log = nulllogger # rubocop:disable Style/GlobalVars
|
38
|
+
end
|
39
|
+
|
40
|
+
require 'fluent/plugin/out_google_cloud'
|