google-cloud-logging 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43b8c5db09219ded373243da0ca00c843a9fc621
4
- data.tar.gz: 1f7283f517b86783fa2411b7a03f93020762851f
3
+ metadata.gz: 055747223efbea95c51a675309d4d35050ab8b18
4
+ data.tar.gz: 7255d083b277697741232f86fa4b08c89cbe5989
5
5
  SHA512:
6
- metadata.gz: cd23872d6e35733f0bdf08775bf74922c1be1263dff90af212be364a5a763b58b9a1b41ab3d77bbcdecfeee6b339057deebcbdec66ef8fdfb3033dd2d484ab02
7
- data.tar.gz: 3fbbb4a987dd9f3012d1917bdcbe09d7f808fb15d815fd3b3c932e92f6bba78a70435766288cab945d912ce37697b507d70985601add2afeb6bd1ab0fd982e37
6
+ metadata.gz: 32e392f48a2abe8ec52428f56157ce9a2fee76ef0483ea33f2bb17c9cd1c957b1d595af3fb503d6130727b6c135e2debb72472007eb1f82a82ab287041a0a65b
7
+ data.tar.gz: 55f318c0491a69100b394c1de617b67335f7a5e270edde3e5956d27dbf056f9507cb0642e9735c7659d8e457f8b91c9c7c254acb3a19f266cc9699889a245503
data/README.md CHANGED
@@ -8,17 +8,32 @@
8
8
 
9
9
  ## Quick Start
10
10
 
11
+ Install the gem directly:
12
+
11
13
  ```sh
12
14
  $ gem install google-cloud-logging
13
15
  ```
14
16
 
15
- ## Authentication
17
+ Or install through Bundler:
18
+
19
+ 1. Add the `google-cloud-logging` gem to your Gemfile:
20
+
21
+ ```ruby
22
+ gem "google-cloud-logging"
23
+ ```
24
+
25
+ 2. Use Bundler to install the gem:
26
+
27
+ ```sh
28
+ $ bundle install
29
+ ```
16
30
 
17
- This library uses Service Account credentials to connect to Google Cloud services. When running on Compute Engine the credentials will be discovered automatically. When running on other environments the Service Account credentials can be specified by providing the path to the JSON file, or the JSON itself, in environment variables.
31
+ Alternatively, check out the [`stackdriver`](../stackdriver) gem that includes
32
+ the `google-cloud-logging` gem.
18
33
 
19
- Instructions and configuration options are covered in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/guides/authentication).
34
+ ## Logging using client library
20
35
 
21
- ## Example
36
+ You can directly read or write log entries through the client library:
22
37
 
23
38
  ```ruby
24
39
  require "google/cloud/logging"
@@ -44,48 +59,102 @@ entry.resource.labels[:version_id] = "20150925t173233"
44
59
  logging.write_entries entry
45
60
  ```
46
61
 
47
- ## Rails Integration
62
+ ## Using Stackdriver Logging in frameworks
63
+
64
+ The `google-cloud-logging` library provides framework integration for popular
65
+ Rack-based frameworks, such as Ruby on Rails and Sinatra, which sets the default
66
+ Rack logger to an instance of the Stackdriver Logging logger.
67
+
68
+ ### With Ruby on Rails
48
69
 
49
- This library also provides a built in Railtie for Ruby on Rails integration. When enabled, it sets an instance of Google::Cloud::Logging::Logger as the default Rails logger. Then all consequent log entries will be submitted to the Stackdriver Logging service.
70
+ You can load the Railtie that comes with the library into your Ruby
71
+ on Rails application by explicitly requiring it during the application startup:
50
72
 
51
- To do this, simply add this line to config/application.rb:
52
73
  ```ruby
74
+ # In config/application.rb
53
75
  require "google/cloud/logging/rails"
54
76
  ```
55
- Then the library can be configured through this set of Rails parameters in config/environments/*.rb:
77
+
78
+ If you're using the `stackdriver` gem, it automatically loads the Railtie into
79
+ your application when it starts.
80
+
81
+ You'll be able to use Stackdriver logger through the standard Rails logger:
82
+
56
83
  ```ruby
57
- # Sharing authentication parameters
58
- config.google_cloud.project_id = "gcp-project-id"
59
- config.google_cloud.keyfile = "/path/to/gcp/secret.json"
60
- # Or more specificly for Logging
61
- config.google_cloud.logging.project_id = "gcp-project-id"
62
- config.google_cloud.logging.keyfile = "/path/to/gcp/sercret.json"
63
-
64
- # Explicitly enable or disable Logging
65
- config.google_cloud.use_logging = true
66
-
67
- # Set Stackdriver Logging log name
68
- config.google_cloud.logging.log_name = "my-app-log"
69
-
70
- # Override default monitored resource if needed. E.g. used on AWS
71
- config.google_cloud.logging.monitored_resource.type = "aws_ec2_instance"
72
- config.google_cloud.logging.monitored_resource.labels.instance_id = "ec2-instance-id"
73
- config.google_cloud.logging.monitored_resource.labels.aws_account = "AWS account number"
84
+ Rails.logger.info "Hello World"
85
+ # Or just...
86
+ logger.warn "Hola Mundo"
74
87
  ```
75
- Alternatively, check out [stackdriver](../stackdriver) gem, which includes this Railtie by default.
76
88
 
77
- ## Rack Integration
89
+ ### With other Rack-based frameworks
90
+
91
+ Other Rack-based applications can use the Rack Middleware to replace the Rack
92
+ logger with the Stackdriver Logging logger:
78
93
 
79
- Other Rack base framework can also directly leverage the built-in Middleware.
80
94
  ```ruby
81
95
  require "google/cloud/logging"
96
+ use Google::Cloud::Logging::Middleware
97
+ ```
82
98
 
83
- logging = Google::Cloud::Logging.new
84
- resource = Google::Cloud::Logging::Middleware.build_monitored_resource
85
- logger = logging.logger "my-log-name",
86
- resource
87
- use Google::Cloud::Logging::Middleware, logger: logger
99
+ Once the Rack logger is set, some Rack-based frameworks, such as Ruby on Rails
100
+ and Sinatra, automatically initialize the default application logger to use the
101
+ Rack logger:
102
+
103
+ ```ruby
104
+ logger.info "Hello World"
105
+ logger.warn "Hola Mundo"
106
+ logger.error "Bonjour Monde"
107
+ ```
108
+
109
+ For other frameworks, consult the documentations on how to utilize the Rack
110
+ logger.
111
+
112
+ ### Configuring the framework integration
113
+
114
+ You can customize the behavior of the Stackdriver Logging framework integration
115
+ for Ruby. See the [configuration guide](../stackdriver/configuration.md) for a
116
+ list of possible configuration options.
117
+
118
+ ## Authentication
119
+
120
+ This library uses Service Account credentials to connect to Google Cloud
121
+ services. When running on Compute Engine the credentials will be discovered
122
+ automatically. When running on other environments the Service Account
123
+ credentials can be specified by providing in several ways.
124
+
125
+ If you're using Ruby on Rails and the library's Rails integration feature, you
126
+ can provide the authentication parameters through the Rails configuration
127
+ interface:
128
+
129
+ ```ruby
130
+ # Add this to config/environments/*.rb
131
+ Rails.application.configure do |config|
132
+ # Shared parameters
133
+ config.google_cloud.project_id = "your-project-id"
134
+ config.google_cloud.keyfile = "/path/to/key.json"
135
+ # Stackdriver Logging specific parameters
136
+ config.google_cloud.logging.project_id = "your-project-id"
137
+ config.google_cloud.logging.keyfile = "/path/to/key.json"
138
+ end
88
139
  ```
140
+ Other Rack-based applications that are loading the Rack Middleware directly can
141
+ use the configration interface:
142
+
143
+ ```ruby
144
+ require "google/cloud/logging"
145
+ Google::Cloud.configure do |config|
146
+ # Shared parameters
147
+ config.project_id = "your-project-id"
148
+ config.keyfile = "/path/to/key.json"
149
+ # Or Stackdriver logging specific parameters
150
+ config.logging.project_id = "your-project-id"
151
+ config.logging.keyfile = "/path/to/key.json"
152
+ end
153
+ ```
154
+
155
+ See the [Authentication
156
+ Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/guides/authentication).
157
+ for more ways to authenticate the client library.
89
158
 
90
159
  ## Supported Ruby Versions
91
160
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Logging
19
- VERSION = "1.2.2"
19
+ VERSION = "1.2.3"
20
20
  end
21
21
  end
22
22
  end
@@ -15,6 +15,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
15
15
  optional :log_name, :string, 12
16
16
  optional :resource, :message, 8, "google.api.MonitoredResource"
17
17
  optional :timestamp, :message, 9, "google.protobuf.Timestamp"
18
+ optional :receive_timestamp, :message, 24, "google.protobuf.Timestamp"
18
19
  optional :severity, :enum, 10, "google.logging.type.LogSeverity"
19
20
  optional :insert_id, :string, 4
20
21
  optional :http_request, :message, 7, "google.logging.type.HttpRequest"
@@ -5,6 +5,7 @@ require 'google/protobuf'
5
5
 
6
6
  require 'google/api/annotations_pb'
7
7
  require 'google/protobuf/empty_pb'
8
+ require 'google/protobuf/field_mask_pb'
8
9
  require 'google/protobuf/timestamp_pb'
9
10
  Google::Protobuf::DescriptorPool.generated_pool.build do
10
11
  add_message "google.logging.v2.LogSink" do
@@ -13,6 +14,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
13
14
  optional :filter, :string, 5
14
15
  optional :output_version_format, :enum, 6, "google.logging.v2.LogSink.VersionFormat"
15
16
  optional :writer_identity, :string, 8
17
+ optional :include_children, :bool, 9
16
18
  optional :start_time, :message, 10, "google.protobuf.Timestamp"
17
19
  optional :end_time, :message, 11, "google.protobuf.Timestamp"
18
20
  end
@@ -46,6 +48,36 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
46
48
  add_message "google.logging.v2.DeleteSinkRequest" do
47
49
  optional :sink_name, :string, 1
48
50
  end
51
+ add_message "google.logging.v2.LogExclusion" do
52
+ optional :name, :string, 1
53
+ optional :description, :string, 2
54
+ optional :filter, :string, 3
55
+ optional :disabled, :bool, 4
56
+ end
57
+ add_message "google.logging.v2.ListExclusionsRequest" do
58
+ optional :parent, :string, 1
59
+ optional :page_token, :string, 2
60
+ optional :page_size, :int32, 3
61
+ end
62
+ add_message "google.logging.v2.ListExclusionsResponse" do
63
+ repeated :exclusions, :message, 1, "google.logging.v2.LogExclusion"
64
+ optional :next_page_token, :string, 2
65
+ end
66
+ add_message "google.logging.v2.GetExclusionRequest" do
67
+ optional :name, :string, 1
68
+ end
69
+ add_message "google.logging.v2.CreateExclusionRequest" do
70
+ optional :parent, :string, 1
71
+ optional :exclusion, :message, 2, "google.logging.v2.LogExclusion"
72
+ end
73
+ add_message "google.logging.v2.UpdateExclusionRequest" do
74
+ optional :name, :string, 1
75
+ optional :exclusion, :message, 2, "google.logging.v2.LogExclusion"
76
+ optional :update_mask, :message, 3, "google.protobuf.FieldMask"
77
+ end
78
+ add_message "google.logging.v2.DeleteExclusionRequest" do
79
+ optional :name, :string, 1
80
+ end
49
81
  end
50
82
 
51
83
  module Google
@@ -59,6 +91,13 @@ module Google
59
91
  CreateSinkRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CreateSinkRequest").msgclass
60
92
  UpdateSinkRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateSinkRequest").msgclass
61
93
  DeleteSinkRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.DeleteSinkRequest").msgclass
94
+ LogExclusion = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogExclusion").msgclass
95
+ ListExclusionsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListExclusionsRequest").msgclass
96
+ ListExclusionsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListExclusionsResponse").msgclass
97
+ GetExclusionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetExclusionRequest").msgclass
98
+ CreateExclusionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CreateExclusionRequest").msgclass
99
+ UpdateExclusionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateExclusionRequest").msgclass
100
+ DeleteExclusionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.DeleteExclusionRequest").msgclass
62
101
  end
63
102
  end
64
103
  end
@@ -43,18 +43,27 @@ module Google
43
43
  # `writer_identity` is not permitted to write to the destination. A sink can
44
44
  # export log entries only from the resource owning the sink.
45
45
  rpc :CreateSink, CreateSinkRequest, LogSink
46
- # Updates a sink. If the named sink doesn't exist, then this method is
47
- # identical to
48
- # [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create).
49
- # If the named sink does exist, then this method replaces the following
50
- # fields in the existing sink with values from the new sink: `destination`,
51
- # `filter`, `output_version_format`, `start_time`, and `end_time`.
52
- # The updated filter might also have a new `writer_identity`; see the
46
+ # Updates a sink. This method replaces the following fields in the existing
47
+ # sink with values from the new sink: `destination`, `filter`,
48
+ # `output_version_format`, `start_time`, and `end_time`.
49
+ # The updated sink might also have a new `writer_identity`; see the
53
50
  # `unique_writer_identity` field.
54
51
  rpc :UpdateSink, UpdateSinkRequest, LogSink
55
52
  # Deletes a sink. If the sink has a unique `writer_identity`, then that
56
53
  # service account is also deleted.
57
54
  rpc :DeleteSink, DeleteSinkRequest, Google::Protobuf::Empty
55
+ # Lists all the exclusions in a parent resource.
56
+ rpc :ListExclusions, ListExclusionsRequest, ListExclusionsResponse
57
+ # Gets the description of an exclusion.
58
+ rpc :GetExclusion, GetExclusionRequest, LogExclusion
59
+ # Creates a new exclusion in a specified parent resource.
60
+ # Only log entries belonging to that resource can be excluded.
61
+ # You can have up to 10 exclusions in a resource.
62
+ rpc :CreateExclusion, CreateExclusionRequest, LogExclusion
63
+ # Changes one or more properties of an existing exclusion.
64
+ rpc :UpdateExclusion, UpdateExclusionRequest, LogExclusion
65
+ # Deletes an exclusion.
66
+ rpc :DeleteExclusion, DeleteExclusionRequest, Google::Protobuf::Empty
58
67
  end
59
68
 
60
69
  Stub = Service.rpc_stub_class
@@ -7,11 +7,16 @@ require 'google/api/annotations_pb'
7
7
  require 'google/api/distribution_pb'
8
8
  require 'google/api/metric_pb'
9
9
  require 'google/protobuf/empty_pb'
10
+ require 'google/protobuf/field_mask_pb'
10
11
  Google::Protobuf::DescriptorPool.generated_pool.build do
11
12
  add_message "google.logging.v2.LogMetric" do
12
13
  optional :name, :string, 1
13
14
  optional :description, :string, 2
14
15
  optional :filter, :string, 3
16
+ optional :metric_descriptor, :message, 5, "google.api.MetricDescriptor"
17
+ optional :value_extractor, :string, 6
18
+ map :label_extractors, :string, :string, 7
19
+ optional :bucket_options, :message, 8, "google.api.Distribution.BucketOptions"
15
20
  optional :version, :enum, 4, "google.logging.v2.LogMetric.ApiVersion"
16
21
  end
17
22
  add_enum "google.logging.v2.LogMetric.ApiVersion" do
@@ -23,6 +23,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
23
23
  end
24
24
  add_message "google.logging.v2.WriteLogEntriesResponse" do
25
25
  end
26
+ add_message "google.logging.v2.WriteLogEntriesPartialErrors" do
27
+ map :log_entry_errors, :int32, :message, 1, "google.rpc.Status"
28
+ end
26
29
  add_message "google.logging.v2.ListLogEntriesRequest" do
27
30
  repeated :project_ids, :string, 1
28
31
  repeated :resource_names, :string, 8
@@ -60,6 +63,7 @@ module Google
60
63
  DeleteLogRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.DeleteLogRequest").msgclass
61
64
  WriteLogEntriesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.WriteLogEntriesRequest").msgclass
62
65
  WriteLogEntriesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.WriteLogEntriesResponse").msgclass
66
+ WriteLogEntriesPartialErrors = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.WriteLogEntriesPartialErrors").msgclass
63
67
  ListLogEntriesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListLogEntriesRequest").msgclass
64
68
  ListLogEntriesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListLogEntriesResponse").msgclass
65
69
  ListMonitoredResourceDescriptorsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListMonitoredResourceDescriptorsRequest").msgclass
@@ -37,7 +37,13 @@ module Google
37
37
  # Log entries written shortly before the delete operation might not be
38
38
  # deleted.
39
39
  rpc :DeleteLog, DeleteLogRequest, Google::Protobuf::Empty
40
- # Writes log entries to Stackdriver Logging.
40
+ # ## Log entry resources
41
+ #
42
+ # Writes log entries to Stackdriver Logging. This API method is the
43
+ # only way to send log entries to Stackdriver Logging. This method
44
+ # is used, directly or indirectly, by the Stackdriver Logging agent
45
+ # (fluentd) and all logging libraries configured to use Stackdriver
46
+ # Logging.
41
47
  rpc :WriteLogEntries, WriteLogEntriesRequest, WriteLogEntriesResponse
42
48
  # Lists log entries. Use this method to retrieve log entries from
43
49
  # Stackdriver Logging. For ways to export log entries, see
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-09-08 00:00:00.000000000 Z
12
+ date: 2017-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core