'How to send NestJs logs to Logstash and Elasticsearch

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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source