How to use winston-elasticsearch - 1 common examples

To help you get started, we’ve selected a few winston-elasticsearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shadowlik / muchas-framework / src / log / elastic.ts View on Github external
transport(level: string, indexPrefix: string): winstonElasticsearch {
        return new winstonElasticsearch({
            indexPrefix,
            level,
            client: this.elasticsearchClient,
            /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
            transformer:(log: any): any => {
                const transformed: {[x: string]: {}} = {};
                transformed['@timestamp'] =
                    log.timestamp ? log.timestamp : new Date().toISOString();
                transformed.message = log.message;
                transformed.severity = log.level;
                // Log error Code
                if (log.meta.errorCode) {
                    transformed.errorCode = log.meta.errorCode;
                    delete log.meta.errorCode;
                }
                // Log unique ID

winston-elasticsearch

An Elasticsearch transport for winston

MIT
Latest version published 7 months ago

Package Health Score

64 / 100
Full package analysis

Popular winston-elasticsearch functions