add image on metadata field on stackdriver logging

7/4/2017

I have an app running on google-container-engine

here is my deployment.yaml:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-cool-app
  namespace: production
spec:
  replicas: 1
  strategy:
      type: RollingUpdate
  template:
    metadata:
      labels:
        app: my-cool-app
    spec:
      containers:
      - name: my-cool-app
        image: us.gcr.io/my-com-example/my-cool-app:v1.0.0
        ports:
        - containerPort: 80

when I log from my app

console.log("hello world")

I get these details on stackdirver:

{
 insertId:  "ohw37fom1d49zx"   
 labels: {
  compute.googleapis.com/resource_id:  "5078535533324994639"    
  compute.googleapis.com/resource_name:  "fluentd-cloud-logging-gke-cluster-6-default-pool-e845398c-1haa"    
  compute.googleapis.com/resource_type:  "instance"    
  container.googleapis.com/cluster_name:  "cluster-1"    
  container.googleapis.com/container_name:  "my-cool-app"    
  container.googleapis.com/instance_id:  "83456078533321234567"    
  container.googleapis.com/namespace_name:  "production"    
  container.googleapis.com/pod_name:  "my-cool-app-2234611398-nfgks"    
  container.googleapis.com/stream:  "stdout"    
 }
 logName:  "projects/my-com-example/logs/my-cool-app"   
 receiveTimestamp:  "2017-06-30T20:38:22.917427457Z"   
 resource: {
  labels: {
   cluster_name:  "cluster-1"     
   container_name:  "my-cool-app"     
   instance_id:  "83456078533321234567"     
   namespace_id:  "production"     
   pod_id:  "my-cool-app-2234611398-nfgks"     
   project_id:  "my-com-example"     
   zone:  "us-central1-f"     
  }
  type:  "container"    
 }
 severity:  "INFO"   
 textPayload:  "hello world"   
 timestamp:  "2017-06-30T20:38:20Z"   
}

is there a way to add on the details (without adding code on my app) also imageId?

something like:

  labels: {
   image: "us.gcr.io/my-com-example/my-cool-app:v1.0.0"
   container_name:  "my-cool-app"           
   pod_id:  "my-cool-app-2234611398-nfgks"     
   ...
   ...
  }

is thee a way to configure what fields will be added on stackdriver?

-- dina
google-cloud-stackdriver
google-kubernetes-engine
stackdriver

0 Answers