stackdriver-nozzle
A service that connects to the Cloud Foundry firehose and sends
logs and metrics to Google Stackdriver.
Installation
go get github.com/cloudfoundry-community/stackdriver-tools/src/stackdriver-nozzle
Configuration
stackdriver-nozzle
is configured through the following environment variables:
Firehose
FIREHOSE_ENDPOINT
- the CF API endpoint; e.g., `https://api.bosh-lite.com'
FIREHOSE_EVENTS
- comma-separated list of events to pass to Stackdriver;
valid events are LogMessage
, ValueMetric
, CounterEvent
, Error
,
ContainerMetric
, HttpStart
, HttpStop
, and HttpStartStop
FIREHOSE_USERNAME
- CF username; defaults to admin
- requires
doppler.firehose
and cloud_controller.admin_read_only
permissions
FIREHOSE_PASSWORD
- CF password; defaults to password
FIREHOSE_SKIP_SSL
- whether to ignore SSL (please don't); defaults to
false
Stackdriver
GCP_PROJECT_ID
- the GCP project ID; will be automatically configured from
the environment using metadata if left empty
Nozzle
HEARTBEAT_RATE
- how often stackdriver-nozzle
reports stats to stdout;
defaults to 30 seconds
BATCH_COUNT
- how many logs and metrics to batch into a single report to
Stackdriver; defaults to 10
BATCH_DURATION
- maximum time to batch logs to Stackdriver; defaults to 1
second
RESOLVE_APP_METADATA
- whether to hydrate app UUIDs into org name, org
UUID, space name, space UUID, and app name; defaults to true
SUBSCRIPTION_ID
- what subscription ID to use for connecting to the
firehose; defaults to stackdriver-nozzle
Usage
go run main.go
Development
Run make newb
to install required development dependencies.
A .envrc.template template is provided for a quick setup. We
suggest copying it to .envrc
and using direnv to automatically set
the environment variables when you're in the stackdriver-nozzle
directory.
When running on GCP, stackdriver-nozzle
will automatically configure
the required credentials and project ID, but they will need to be provided
manually through environment variables (see above) when running locally. You
can get the credentials JSON file by following Google's instructions
here from the credentials console.
Ginkgo is used for testing.
ginkgo -r
Dependencies
This project uses govendor for
dependency management.
govendor fetch +missing