I am using the @google-cloud/logging-bunyan (^1.2.3) library with bunyan (^1.8.12) to produce some logs that would be saved to bigquery using a sink. I wanted to pass the logName attribute since it is used to create the table (table name). I am doing so since i want to have multiple table for the same backend (nodeJS 8.16.1). I carried a test using an app engine and it worked perfectly but after a deployed it to the GKE cluster, it did not print the logName the specified. Here is the code snippet i deployed to give you an idea :
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});
}
and here is the format of the log i got :
{
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"
}
as you see logName is not the one i specified. What do you think the problem is ?