Demonstrates how to retrieve the metadata for a Cloud Logging Sink.

Code Sample


To learn how to install and use the client library for Logging, see the Logging Client Libraries.

// Imports the Google Cloud client library
const {Logging} = require('@google-cloud/logging');

// Creates a client
const logging = new Logging();

 * TODO(developer): Uncomment the following line to run the code.
// const sinkName = 'Name of your sink, e.g. my-sink';

const sink = logging.sink(sinkName);

async function printSinkMetadata() {
  // See
  const [metadata] = await sink.getMetadata();
  console.log(`Name: ${}`);
  console.log(`Destination: ${metadata.destination}`);
  console.log(`Filter: ${metadata.filter}`);