在stackdriver日志记录上的元数据字段上添加图像

时间:2017-07-04 06:05:13

标签: google-kubernetes-engine stackdriver google-cloud-stackdriver

我在google-container-engine

上运行了一个应用

这是我的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

从我的应用程序登录时

console.log("hello world")

我在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"   
}

有没有办法添加细节(不在我的应用程序上添加代码)还有imageId?

类似的东西:

  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"     
   ...
   ...
  }

是一种配置将在stackdriver上添加哪些字段的方法吗?

0 个答案:

没有答案