I am unable to see log messages that are sent from my GKE clusters using Golang. They work fine when running locally but not from the container running in GKE. Clearly something is misconfigured in GKE but I don't see any errors but not really sure where to look. Any insight or places to check would be very useful.
Below is my code and my cluster scopes (if it helps).
Thank you.
oauthScopes:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/compute
- https://www.googleapis.com/auth/datastore
- https://www.googleapis.com/auth/devstorage.full_control
- https://www.googleapis.com/auth/devstorage.read_only
- https://www.googleapis.com/auth/logging.write
- https://www.googleapis.com/auth/monitoring
- https://www.googleapis.com/auth/monitoring.write
- https://www.googleapis.com/auth/pubsub
- https://www.googleapis.com/auth/service.management.readonly
- https://www.googleapis.com/auth/servicecontrol
- https://www.googleapis.com/auth/source.full_control
- https://www.googleapis.com/auth/sqlservice.admin
- https://www.googleapis.com/auth/trace.appendCode:
func LogMessage(logLevel ReddiyoLoggingSeverity, message, domain, transactionID string) {
ctx := context.Background()
// Creates a client.
client, err := logging.NewClient(ctx, loggingData.ProjectID)
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// Selects the log to write to.
logger := client.Logger(loggingData.LogName)
labels := make(map[string]string)
labels["transactionID"] = transactionID
labels["domain"] = domain
var logSeverity logging.Severity
switch logLevel {
case debug:
logSeverity = logging.Debug
case info:
logSeverity = logging.Info
case warning:
logSeverity = logging.Warning
case reddiyoError:
logSeverity = logging.Error
case critical:
logSeverity = logging.Critical
case emergency:
logSeverity = logging.Emergency
default:
logSeverity = logging.Warning
}
logger.Log(logging.Entry{
Payload: message,
Severity: logSeverity,
Labels: labels})
// Closes the client and flushes the buffer to the Stackdriver Logging
// service.
if err := client.Close(); err != nil {
log.Fatalf("Failed to close client: %v", err)
}
}--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To post to this group, send email to google-stackdr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/69566c3e-3cce-40da-b700-d70f8e437eb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.