nodejs-logging-winston: Not showing `resource.labels.function_name` nor `labels."execution_id"`
Environment details
- OS: Firebase
- Node.js version: v6.14.0
- npm version:
@google-cloud/logging-winston
version: 0.9.0
Steps to reproduce
- Set up logging-winston as per the Google docs:
const winston = require('winston');
const Logger = winston.Logger;
const Console = winston.transports.Console;
const LoggingWinston = require('@google-cloud/logging-winston').LoggingWinston;
const loggingWinston = new LoggingWinston();
const logger = new Logger({
level: 'info',
transports: [
new Console(),
// for Stackdriver
loggingWinston,
],
});
module.exports = logger
- Log a payload
logger.info('Audit', {foo: 'bar'})
- StackDriver console shows an
Audit
entry, but withoutresource.labels.function_name
andlabels."execution_id"
I’d like to see my Winston log entry have these attributes as if I used regular console.log
:

About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 18 (10 by maintainers)
Commits related to this issue
- feat: autopopulate GCF metadata Fixes: #91 — committed to DominicKramer/nodejs-logging-winston by DominicKramer 5 years ago
Thanks, but the reason I want to use this package was to get structured logging. Thanks for looking into it.
I would also like to use structured logging and not getting the execution_id with Winston.
Would be great to have this re-opened.
Still struggling to get the
execution_id
.https://cloud.google.com/functions/docs/monitoring/logging#writing_logs
Given that the official documentation actually suggests using something other than console.log, can this issue get re-opened?
Thanks @DominicKramer , it’ll be especially nice to see
execution_id
on there.Thanks for opening this issue. I agree with your assessment of the issue that you would need to supply the labels in question.
I have re-opened this issue as a feature request since it would be good to determine if these labels should be applied automatically if/when available.
However, it is good that, even if the labels are not applied automatically, they can still be applied manually to get the desired functionality.
@opyate were you ever able to find a solution to this ? I’ve resorted to using winston to be able to set severity, but have now lost the labels that were pushed by CF by default
@ofrobots That’s a great point. For express users we can automatically include the
execution_id
. 😃We do have this capability through the
request.log
function added by the express middleware.