npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

logstash-js

v1.0.5

Published

It's like logstash but using javascript streams

Downloads

2

Readme

Logstash-js

It's like logstash but using javascript streams

Usage

npm install logstash-js -g

You can now use the command

logstash-js myconf.json

Inputs

File Input

Props

path The full file path

{
  "input": {
    "file": {
      "path": "D:/Development/logstash-js/dataset/myFile.csv"
    }
  },
  "output": {
    "debug": true
  }
}

Http Input

Props

path The http server path

method The request method

headers The request headers

user The basic auth user

password The basic auth password

{
  "input": {
    "http": {
      "path": "https://jsonplaceholder.typicode.com/todos",
      "method": "GET"
    }
  },
  "output": {
    "debug": true
  }
}

Mongodb Input

Props

user The connection user

password The connection password

host The connection host

port The connection port

  • Default value is 27017

database The connection database

collection The collection to use for querying

query The full text query

schedule Call the query according to a schedule

  • Optional
  • Example "schedule": { "every": "2s" }
{
  "input": {
    "mongodb": {
      "user": "",
      "password": "",
      "host": "localhost",
      "database": "mydatabase",
      "collection": "mycollection",
      "query": "{}",
      "schedule": {
        "every": "2s"
      }
    }
  },
  "output": {
    "debug": true
  }
}

Mysql Input

Props

user The connection user

password The connection password

host The connection host

port The connection port

  • Default value is 5432

database The connection database

query The full text query

schedule Call the query according to a schedule

  • Optional
  • Example "schedule": { "every": "2s" }
{
  "input": {
    "mysql": {
      "user": "root",
      "password": "",
      "host": "localhost",
      "database": "logstash",
      "query": "SELECT * FROM mytable"
    }
  },
  "output": {
    "debug": true
  }
}

Pgsql Input

Props

user The connection user

password The connection password

host The connection host

port The connection port

  • Default value is 5432

database The connection database

query The full text query

schedule Call the query according to a schedule

  • Optional
  • Example "schedule": { "every": "2s" }
{
  "input": {
    "pgsql": {
      "user": "root",
      "password": "",
      "host": "localhost",
      "database": "logstash",
      "query": "SELECT * FROM mytable"
    }
  },
  "output": {
    "debug": true
  }
}

Transforms

Csv Transform

Props

delimiter the csv delimiter

{
  "input": {
    "file": {
      "path": "D:/Development/logstash-js/dataset/myFile.csv"
    }
  },
  "transform": {
    "csv": {
      "delimiter": ","
    }
  },
  "output": {
    "debug": true
  }
}

Mutate Transform

Props

rename_field An object with each field to rename

  • Example "rename_field": { "_id": "id" }

remove_field An array with a list of field to remove

  • Example "remove_field": ["name"]

add_field An object with each field to add

  • Example "add_field": { "my_super_field": "aa" }
{
  "input": {
    "mongodb": {
      "user": "",
      "password": "",
      "host": "localhost",
      "database": "mydatabase",
      "collection": "mycollection",
      "query": "{}"
    }
  },
  "transform": {
    "mutate": {
      "rename_field": {
        "_id": "id"
      },
      "add_field": {
        "my_super_field": "aa"
      },
      "remove_field": ["name"]
    }
  },
  "output": {
    "debug": true
  }
}

Outputs

Debug Output

{
  "output": {
    "debug": true
  }
}

File Output

Props

path The full file output path

{
  "output": {
    "file": {
      "path": "myOutput.csv"
    }
  }
}

Elasticsearch Output

Props

user The connection user

password The connection password

host The connection host

index The index to output the data to

protocol The connection protocol

  • Default http

document_id The document to index _id

  • Optional
{
  "input": {
    "mysql": {
      "user": "root",
      "password": "",
      "host": "localhost",
      "database": "logstash",
      "query": "SELECT * FROM mytable"
    }
  },
  "output": {
    "debug": true,
    "elasticsearch": {
      "protocol": "http",
      "host": "localhost:9200",
      "user": "",
      "password": "",
      "index": "test_index",
      "document_id": "id"
    }
  }
}

Environnement variables

You can use ${MY_VARIABLE} to retrieve an environnement variable

{
  "input": {
    "mysql": {
      "user": "${MYSQL_USER}",
      "password": "",
      "host": "${MYSQL_HOST}",
      "database": "logstash",
      "query": "SELECT * FROM mytable"
    }
  },
  "output": {
    "debug": true,
    "elasticsearch": {
      "protocol": "http",
      "host": "localhost:9200",
      "user": "",
      "password": "",
      "index": "test_index"
    }
  }
}