Skip to content

Commit 04d24d2

Browse files
committed
update readme and version
1 parent 56bf87c commit 04d24d2

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ npm install bunyan-elasticsearch
1111

1212
## Logstash Template
1313

14-
By default Logstash will create a dynamic template that will take care of crating `.raw` fields for your data. In order to replicate this behaivor you will need to create the dynamic template manually. You will need to [download template.json](https://raw.github.com/ccowan/bunyan-elasticsearch/master/template.json) and run the following command from the same directory as that file:
14+
By default Logstash will create a dynamic template that will take care of crating `.raw` fields for your data. In order to replicate this behavior you will need to create the dynamic template manually. You will need to [download template.json](https://raw.github.com/ccowan/bunyan-elasticsearch/master/template.json) and run the following command from the same directory as that file:
1515

1616
```
1717
curl -XPUT localhost:9200/_template/logstash -d @template.json
@@ -25,7 +25,10 @@ var Elasticsearch = require('bunyan-elasticsearch');
2525
var esStream = new Elasticsearch({
2626
indexPattern: '[logstash-]YYYY.MM.DD',
2727
type: 'logs',
28-
host: 'localhost:9200'
28+
host: 'localhost:9200'
29+
});
30+
esStream.on('error', function (err) {
31+
console.log('Elasticsearch Stream Error:', err.stack);
2932
});
3033
3134
var logger = bunyan.createLogger({
@@ -40,3 +43,11 @@ var logger = bunyan.createLogger({
4043
logger.info('Starting application on port %d', app.get('port'));
4144
```
4245

46+
## Options
47+
48+
* `client`: Elasticsearch client. Defaults to new client created with current set of options as an argument
49+
* `type` {string|function}: Elasticsearch `type` field. Default: `'logs'`
50+
* `indexPattern` {string}: Used to generate index if `index` option not set. Default: `'[logstash-]YYYY.MM.DD'`
51+
* `index` {string|function}: Elasticsearch index. Defaults to index generated using index pattern
52+
53+
Options `type` and `index` can be either a string or function. For these options, when the option is set to a function, the function is passed the log entry object as an argument

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bunyan-elasticsearch",
3-
"version": "0.0.4",
3+
"version": "1.0.0",
44
"description": "A Bunyan stream for sending log data to Elasticsearch",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)