Simple service that will let you pipe logs directly to Stackdriver Logging.
Google App Engine and Container Engine automatically stream logs to Stackdriver Logging. Docker also supports streaming logs to Stackdriver.
However, raw Compute Engine does not. Other cloud VMs also do not. You can install the logging agent on Compute Engine, but that requires you to log to a common log file, custom log file, or syslog.
If you want a simple way to stream logs from the Stdout of any program to Stackdriver Logging, this is for you!
You can download a pre-compiled binary for your system here.
Otherwise:
go get -u github.com/thesandlord/logpipe
Note: If you are running on Google Compute Engine, there is no need for any setup.
If you want to use this on your local machine, install the Google Cloud SDK and run:
gcloud auth application-default login
If you are running on a VM outside Google Cloud, follow the steps here to set the GOOGLE_APPLICATION_CREDENTIALS
environment variable.
Usage:
logpipe [OPTIONS]
Application Options:
-p, --project= Google Cloud Platform Project ID
-l, --logname= The name of the log to write to (default: default)
Help Options:
-h, --help Show this help message
This will log all the output from a Node.js program
node app.js | logpipe -p <YOUR_PROJECT_ID>
This will log the word "hello" 5 times to the "default" log
yes hello | head -n 5 | logpipe -p <YOUR_PROJECT_ID>
This will log the word "test" to the "tester" log
echo test | logpipe -p <YOUR_PROJECT_ID> -l tester