0

I am using NestJS as a backend service and in that I am using default Logger provided by Nestjs for logging. I want to ship these logs to Logstash, Elasticsearch as I am new to ELK. I am not getting any idea of how to implement this:

Below is my logging service:

app.service.ts

import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {

  private readonly logger = new Logger(AppService.name);

  getHello(): string {
    this.logger.info('Logging test');
    return 'Hello World!';
  }
}

How can I perform this task?

halfer
  • 19,824
  • 17
  • 99
  • 186
Digvijay
  • 2,887
  • 3
  • 36
  • 86
  • did you try to search on google ? you will get lot of suggestion with example. check this [blog](https://qbox.io/blog/parsing-logs-using-logstash/) – Sagar Patel Mar 15 '22 at 08:28
  • I got it and I tried it as shown in the blog but its showing error can you please loook into my new post https://stackoverflow.com/questions/71479384/unable-to-start-logstash-server-and-throwing-error – Digvijay Mar 15 '22 at 08:57

1 Answers1

0

You can use pino logger and pino-elasticsearch to log into elastic search directly if you don't want the request based than you can log the data in files and use Filebeat to send that data to logstash or elastic search directly.

iamsr
  • 314
  • 2
  • 6