0.1.1 • Published 8 years ago

flume-spool v0.1.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
8 years ago

flume-spool

Build Status Coverage Status

The repository is to support flume spooling directory source for node.

Note: only support Node > 4.0.0 and Apache Flume > 1.3.0

Installation

$ npm install flume-spool

Usage

Opening a log stream:

const FlumeSpool = require('flume-spool')
const log = new FlumeSpool('/path/to/spool/directory', [options])

log.write('some logs \n')

See the examples/ folder for more examples.

Options

Available options:

NameTypeDefaultDescription
intervalnumber60000(60s)The time interval for transfering files from temporary directory to spool directory.
tempDirstring./flume_tempThe directory for temporary logs.
autoDeletebooleanfalseRemove completed files using node.
autoDeleteIntervalnumber600000(10min)---
autoDeleteSuffixRegregexp/.COMPLETED$/---
streamEncodingstringutf8The config for the log stream.
streamModenumber0644---
streamFlagsstringa---

Methods

  • write(chunk<String|Buffer>): write data to log stream
  • close(): close log stream

Flume Config

Example for the agent using spooling directory source:

agent.sources.s1.type = spooldir
agent.sources.s1.channels = ch1
agent.sources.s1.spoolDir = /path/to/spool/directory
agent.sources.s1.fileHeader = true
# auto delete completed files
agent.sources.s1.deletePolicy = immediate

See FlumeUserGuide for all available options.

Events

The instance will emit some events in running:

EventDescription
openemit when being initialized
transferemit when the temporary file is transfered
closeemit when being closed
erroremit when an error occurs

Tests

$ npm test

License

Apache-2.0

0.1.1

8 years ago

0.1.0

8 years ago