
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
bunyan-elasticsearch
Advanced tools
A Bunyan stream for saving logs into Elasticsearch.
npm install bunyan-elasticsearch
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 and run the following command from the same directory as that file:
curl -XPUT localhost:9200/_template/logstash -d @template.json
var bunyan = require('bunyan');
var Elasticsearch = require('bunyan-elasticsearch');
var esStream = new Elasticsearch({
indexPattern: '[logstash-]YYYY.MM.DD',
type: 'logs',
host: 'localhost:9200'
});
esStream.on('error', function (err) {
console.log('Elasticsearch Stream Error:', err.stack);
});
var logger = bunyan.createLogger({
name: "My Application",
streams: [
{ stream: process.stdout },
{ stream: esStream }
],
serializers: bunyan.stdSerializers
});
logger.info('Starting application on port %d', app.get('port'));
client
: Elasticsearch client. Defaults to new client created with current set of options as an argumenttype
{string|function}: Elasticsearch type
field. Default: 'logs'
indexPattern
{string}: Used to generate index if index
option not set. Default: '[logstash-]YYYY.MM.DD'
index
{string|function}: Elasticsearch index. Defaults to index generated using index patternOptions 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
FAQs
A Bunyan stream for sending log data to Elasticsearch
The npm package bunyan-elasticsearch receives a total of 901 weekly downloads. As such, bunyan-elasticsearch popularity was classified as not popular.
We found that bunyan-elasticsearch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.