cloud-logging-exporter is a command line agent tool to export file or stdin contents to Cloud Logging.


go install[email protected]


./cloud-logging-exporter  -h
Usage of ./cloud-logging-exporter:
  -file string
    	target file path for export
  -logname string
    	log name for Cloud Logging (default "cloud-logging-exporter")
    	whether print log with stdout.
  -project string
    	GCP project
    	export saved contents of file.
  -severity string
    	log severity(default|debug|info|notice|warning|error|critical|alert|emergency) (default "info")
    	touch file if not exists.

You needs GOOGLE_APPLICATION_CREDENTIALS environment variables to authenticate Google Cloud. And authenticated user needs roles/logging.logWriter role.

You can export stdin as below execution.

tail -f /path/to/file | ./cloud-logging-exporter


View Github