@google cloud/logging bunyan没有生成我在代码中编写的日志名

@google cloud/logging bunyan没有生成我在代码中编写的日志名,logging,google-cloud-platform,stackdriver,google-cloud-stackdriver,bunyan,Logging,Google Cloud Platform,Stackdriver,Google Cloud Stackdriver,Bunyan,我正在使用@google cloud/logging bunyan(^1.2.3)库和bunyan(^1.8.12)生成一些日志,这些日志将使用接收器保存到bigquery。 我想传递logName属性,因为它用于创建表(表名)。我这样做是因为我想为同一后端拥有多个表(nodeJS 8.16.1)。 我使用appengine进行了一个测试,它工作得很好,但是在将它部署到GKE集群之后,它没有打印指定的日志名。 下面是我部署的代码片段,让您了解: import bunyan from 'bunya

我正在使用@google cloud/logging bunyan(^1.2.3)库和bunyan(^1.8.12)生成一些日志,这些日志将使用接收器保存到bigquery。 我想传递logName属性,因为它用于创建表(表名)。我这样做是因为我想为同一后端拥有多个表(nodeJS 8.16.1)。 我使用appengine进行了一个测试,它工作得很好,但是在将它部署到GKE集群之后,它没有打印指定的日志名。 下面是我部署的代码片段,让您了解:

import bunyan from 'bunyan';
import { LoggingBunyan } from '@google-cloud/logging-bunyan';

const loggingBunyan = new LoggingBunyan({
  logName: 'driver-status-location', // table name
});
export const driverLocationStatusLogger = bunyan.createLogger({
  name: 'yassir-backend-main-log',
  streams: [
    // Log to the console at 'info' and above
    { stream: process.stdout, level: 'info' },
    // And log to Stackdriver Logging, logging at 'info' and above
    loggingBunyan.stream('info'),
  ],
});

export const customDriverLocationStatusLogger = (action, metadata) =>{ 
    driverLocationStatusLogger.info({ labels: { action }, metadata});
}

这是我得到的日志的格式:

{
 insertId: "hecxukciyeulfqocw"  
 jsonPayload: {…}  
 labels: {…}  
 logName: "projects/xxx-xx-xx/logs/stdout"  
 receiveTimestamp: "2019-10-10T09:10:16.034265465Z"  
 resource: {…}  
 severity: "INFO"  
 timestamp: "2019-10-10T09:10:15.292Z"  
}

正如您所看到的,logName不是我指定的那个。
你认为问题出在哪里?

你能解释一下你在AppEngine中看到的东西吗?你说与GKE相比,它工作得很好?另外,我发现这个相似的可能会帮助你。不,它不相似。该线程中的人员正在讨论严重性级别,我正在讨论logName属性:它应该是logName:“projects/swift-implement-155307/logs/driver status location,因为我使用了logName:“driver status location”,但它是logName:“projects/swift-implement-155307/logs/stdout insteadOk我找到了解决方案(问题)我想和大家分享一下。出于某种原因,当我使用GKE时,总会有两个类似的日志。唯一的区别是,一个是从我的代码(@googlecloud/logging bunyan)生成的,另一个来自其他地方(可能是fluentd),所以现在我在过滤器中使用一个额外的行(使用logName进行过滤),以便仅从我的代码中获取日志。希望这能帮助有同样问题的人