Ghost/ghost/core/loggingrc.js
Daniel Lockyer 34fe49b110
Added version information to log lines
refs https://github.com/TryGhost/Toolbox/issues/501

- this reverts commit 48dda23554
- also includes a resolution for `@elastic/elasticsearch` so we don't
  run a version that is potentially problematic - see referenced issue
  for context
2023-01-20 13:18:44 +01:00

28 lines
743 B
JavaScript

const config = require('./core/shared/config');
const ghostVersion = require('@tryghost/version');
// Config for logging
const loggingConfig = config.get('logging') || {};
if (!loggingConfig.path) {
loggingConfig.path = config.getContentPath('logs');
}
// Additional values used by logging
loggingConfig.env = config.get('env');
loggingConfig.domain = config.get('url');
loggingConfig.metadata = {
version: ghostVersion.original
};
// Config for metrics
loggingConfig.metrics = config.get('logging:metrics') || {};
loggingConfig.metrics.metadata = {
// Undefined if unavailable
siteId: config.get('hostSettings:siteId'),
domain: config.get('url'),
version: ghostVersion.original
};
module.exports = loggingConfig;