Skip to content

Commit

Permalink
update loki transport
Browse files Browse the repository at this point in the history
  • Loading branch information
filvecchiato committed Aug 19, 2024
1 parent ac32529 commit 971dbea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/logging/Log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

import { createLogger, Logger } from 'winston';
import { ConsoleTransportInstance, FileTransportInstance } from 'winston/lib/winston/transports';
import LokiTransport from 'winston-loki';

import { SidecarConfig } from '../SidecarConfig';
import { consoleTransport, fileTransport } from './transports';
import LokiTransport from 'winston-loki';

/**
* Access a singleton winston.Logger that will be intialized on first use.
Expand All @@ -42,11 +42,13 @@ export class Log {
}

if (SidecarConfig.config.METRICS.ENABLED) {
this._transports.push(new LokiTransport({
host: `http://${SidecarConfig.config.METRICS.LOKI_HOST}:${SidecarConfig.config.METRICS.LOKI_PORT}`,
useWinstonMetaAsLabels: true,
json: true,
}))
this._transports.push(
new LokiTransport({
host: `http://${SidecarConfig.config.METRICS.LOKI_HOST}:${SidecarConfig.config.METRICS.LOKI_PORT}`,
useWinstonMetaAsLabels: true,
json: true,
}),
);
}

this._logger = createLogger({
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function main() {

if (config.METRICS.ENABLED) {
// Create Metrics App
const metricsApp = new Metrics_App({
const metricsApp = new MetricsApp({
port: config.METRICS.PROM_PORT,
host: config.METRICS.PROM_HOST,
});
Expand Down

0 comments on commit 971dbea

Please sign in to comment.