Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce Logging support #865

Merged
merged 1 commit into from
Dec 21, 2015

Conversation

stephenplusplus
Copy link
Contributor

Fixes #842

Must Reads

To Dos

  • Make sure ACLs are properly set for Topics: introduce Logging support #865 (comment)
  • Enable Cloud Logging API on System Test Account
  • Document createSink.config.filter
  • Inherit from Service / ServiceObject
  • Support Sink destinations
    • Storage Bucket
    • BigQuery Dataset
    • Pub/Sub Topic
  • Docs
    • Readme
    • JSDocs
    • Site
  • Tests
    • System
    • Unit
      • Index
      • Log
      • Sink

Preview

// Authenticating on a global-basis. You can also authenticate on a per-API-
// basis (see Authentication section above).
var gcloud = require('gcloud')({
  projectId: 'my-project',
  keyFilename: '/path/to/keyfile.json'
});

var logging = gcloud.logging();

// Create a sink using a Bucket as a destination.
var gcs = gcloud.storage();

logging.createSink('my-new-sink', {
  destination: gcs.bucket('my-sink')
}, function(err, sink) {});

// Write a critical entry to a log.
var syslog = logging.log('syslog');

var resource = {
  type: 'gce_instance',
  labels: {
    zone: 'global',
    instance_id: 3
  }
};

var entry = syslog.entry(resource, {
  delegate: process.env.user
});

syslog.critical(entry, function(err) {});

// Get all entries in your project.
logging.getEntries(function(err, entries) {
  if (!err) {
    // `entries` contains all of the entries from the logs in your project.
  }
});

@stephenplusplus stephenplusplus added don't merge api: logging Issues related to the Cloud Logging API. labels Sep 15, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 15, 2015
@stephenplusplus stephenplusplus force-pushed the spp--logging branch 2 times, most recently from 6fc0d0a to 02f18aa Compare September 16, 2015 17:25
@stephenplusplus stephenplusplus added the status: blocked Resolving the issue is dependent on other work. label Oct 1, 2015
@stephenplusplus stephenplusplus force-pushed the spp--logging branch 2 times, most recently from 769488e to b782682 Compare October 20, 2015 14:47
@stephenplusplus stephenplusplus removed the status: blocked Resolving the issue is dependent on other work. label Oct 20, 2015
@stephenplusplus stephenplusplus force-pushed the spp--logging branch 2 times, most recently from 01fb9f7 to 5e7faac Compare October 20, 2015 16:35
@stephenplusplus stephenplusplus force-pushed the spp--logging branch 8 times, most recently from 6c68dba to b29cd90 Compare November 17, 2015 17:17
@stephenplusplus
Copy link
Contributor Author

@VikramTiwari - your thoughts are most welcome if you have the chance to play around with this!

$ npm install --save stephenplusplus/gcloud-node#spp--logging

@VikramTiwari
Copy link

Hey @stephenplusplus I am at Chrome Dev Summit for today and tomorrow, but I will be testing it by the end of week for sure. 👍

@stephenplusplus
Copy link
Contributor Author

@VikramTiwari awesome! I'll look for you on the feed 🌠

@stephenplusplus
Copy link
Contributor Author

@jgeewax to prepare for this to merge, can you check that the Logging API is enabled for the Travis project?

@stephenplusplus
Copy link
Contributor Author

Also, any ideas for getting Travis to auth as a user? Many of our system tests require user-level, non-service account auth.

if (config.destination instanceof Dataset) {
var dataset = config.destination;

config.destination = format('{baseUrl}/projects/{pId}/datasets/{dId}', {

This comment was marked as spam.

This comment was marked as spam.

delegate: process.env.user
});

log.critical(entry, function(err) {});

This comment was marked as spam.

*
* var config = {
* destination: gcs.bucket('logging-bucket'),
* filter: 'metadata.severity = ALERT'

This comment was marked as spam.

*
* @private
*/
Logging.prototype.setAclForTopic_ = function(name, config, callback) {

This comment was marked as spam.

This comment was marked as spam.

* @return {string}
*/
Log.formatName_ = function(projectId, name) {
if (name.indexOf('logs/') > -1) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

policy.bindings = arrify(policy.bindings);

policy.bindings.push({
role: 'roles/editor',

This comment was marked as spam.

This comment was marked as spam.

callmehiphop added a commit that referenced this pull request Dec 21, 2015
@callmehiphop callmehiphop merged commit 8db014a into googleapis:master Dec 21, 2015
@callmehiphop
Copy link
Contributor

Thanks @stephenplusplus! Also, thanks for the review @filipjs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants