Skip to content

Commit

Permalink
Move node recommended setup to @fluent-org/logger
Browse files Browse the repository at this point in the history
Given fluent/fluent-logger-node#177, `(`fluent-logger-node`)[https://github.com/fluent/fluent-logger-node] has been replaced with (`fluent-logger-forward-node`)[https://github.com/fluent/fluent-logger-forward-node]. This updates the documentation to reflect that.
  • Loading branch information
jamiees2 authored Aug 25, 2021
1 parent 9bcb1ab commit 22341e8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions language-bindings/nodejs.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Nodejs

The [`fluent-logger-node`](https://github.com/fluent/fluent-logger-node) library is used to post records from Node.js applications to Fluentd.
The [`@fluent-org/logger`](https://github.com/fluent/fluent-logger-forward-node) library is used to post records from Node.js applications to Fluentd.

This article explains how to use it.

## Prerequisites

* Basic knowledge of Node.js and NPM
* Basic knowledge of Fluentd
* Node.js 6.0 or higher
* Node.js 12.0 or higher

## Installing Fluentd

Expand Down Expand Up @@ -43,15 +43,15 @@ $ sudo /etc/init.d/td-agent restart
$ sudo systemctl restart td-agent.service
```

## Using `fluent-logger-node`
## Using `@fluent-org/logger`

### Obtaining the Most Recent Version

The most recent version of `fluent-logger-node` can be found [here](https://www.npmjs.com/package/fluent-logger).
The most recent version of `@fluent-org/logger` can be found [here](https://www.npmjs.com/package/@fluent-org/logger).

### A Sample Application

Here is a sample [Express](http://expressjs.com/) app using `fluent-logger-node`:
Here is a sample [Express](http://expressjs.com/) app using `@fluent-org/logger`:

#### `package.json`

Expand All @@ -61,7 +61,7 @@ Here is a sample [Express](http://expressjs.com/) app using `fluent-logger-node`
"version": "0.0.1",
"dependencies": {
"express": "^4.16.0",
"fluent-logger": "^3.2.0"
"@fluent-org/logger": "^1.0.2"
}
}
```
Expand All @@ -78,15 +78,16 @@ This is a simple web app:

```text
const express = require('express');
const logger = require('fluent-logger');
const FluentClient = require('@fluent-org/logger').FluentClient;
const app = express();
// The 2nd argument can be omitted. Here is a default value for options.
logger.configure('fluentd.test', {
host: 'localhost',
port: 24224,
timeout: 3.0,
reconnectInterval: 600000 // 10 minutes
const logger = new FluentClient('fluentd.test', {
socket: {
host: 'localhost',
port: 24224,
timeout: 3000, // 3 seconds
}
});
app.get('/', function(request, response) {
Expand Down

0 comments on commit 22341e8

Please sign in to comment.