Skip to content

Commit

Permalink
Merge pull request #80 from fluent/handshake
Browse files Browse the repository at this point in the history
Support handshake
  • Loading branch information
okkez authored Oct 10, 2017
2 parents 48ac67f + a12d6c1 commit 2e31027
Show file tree
Hide file tree
Showing 8 changed files with 753 additions and 85 deletions.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,43 @@ The emit method has following signature
Where only the `record` argument is required. If the label is set it will be
appended to the configured tag.

### Shared key authentication

Logger configuration:

```js
var logger = require('fluent-logger').createFluentSender('tag_prefix', {
host: 'localhost',
port: 24224,
timeout: 3.0,
reconnectInterval: 600000, // 10 minutes
security: {
clientHostname: "client.localdomain",
sharedKey: "secure_communication_is_awesome"
}
});
logger.emit('debug', { message: 'This is a message' });
```

Server configuration:

```aconf
<source>
@type forward
port 24224
<security>
self_hostname input.testing.local
shared_key secure_communication_is_awesome
</security>
</source>
<match dummy.*>
@type stdout
</match>
```

See also [Fluentd](https://github.com/fluent/fluentd) examples.

### EventTime support

We can also specify [EventTime](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#eventtime-ext-format) as timestamp.
Expand Down Expand Up @@ -237,6 +274,33 @@ Change the protocol to at-least-once. The logger waits the ack from destination.
This option is used when requireAckResponse is true. The default is 190. This default value is based on popular `tcp_syn_retries`.
**eventMode**
Set [Event Modes](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#event-modes). This logger supports `Message`, `PackedForward` and `CompressedPackedForward`.
Default is `Message`.
**flushInterval**
Set flush interval in milliseconds. This option has no effect in Message mode.
The logger stores emitted events in buffer and flush events for each interval.
Default `100`.
**security.clientHostname**
Set hostname of this logger. Use this value for hostname based authentication.
**security.sharedKey**
Shared key between client and server.
**security.username**
Set username for user based authentication. Default values is empty string.
**security.password**
Set password for user based authentication. Default values is empty string.
**internalLogger**
Set internal logger object for FluentLogger. Use `console` by default.
Expand All @@ -249,6 +313,6 @@ Apache License, Version 2.0.
[fluent-logger-python]: https://github.com/fluent/fluent-logger-python
## Abour NodeJS versions
## About NodeJS versions
This package is compatible with NodeJS versions > 4.
8 changes: 7 additions & 1 deletion lib/logger-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ var DataTypeError = function DataTypeError(message, options) {
};
util.inherits(DataTypeError, BaseError);

var HandshakeError = function HandshakeError(message, options) {
HandshakeError.super_.call(this, message, options);
};
util.inherits(HandshakeError, BaseError);

module.exports = {
MissingTag: MissingTagError,
ResponseError: ResponseError,
DataTypeError: DataTypeError,
ResponseTimeout: ResponseTimeoutError
ResponseTimeout: ResponseTimeoutError,
HandshakeError: HandshakeError
};
Loading

0 comments on commit 2e31027

Please sign in to comment.