Git Product home page Git Product logo

kafka-log-simulator's Introduction

Kafka Log Simulator

This application simulates delivery of log messages to IBM Message Hub using Apache Kafka. It is intended to be used with the solution tutorial Big data log analytics with Streaming Analytics and SQL.

Usage

Usage: index --file <file> --parser <name> (--messages | --csv) --broker-list <brokers> --api-key <secret> --topic <name> --rate [speed]

  Options:

    -f, --file [file]               Log file to create messages from
    -p, --parser [parser]           File parser
    -m, --messages [parser]         Stream log messages to Message Hub
    -c, --csv                       Stream log messages to CSV file
    -b, --broker-list [brokerList]  Message Hub brokers list (multiple brokers comma separated)
    -k, --api-key [apiKey]          Message Hub API key
    -t, --topic [topic]             Message Hub topic
    -r, --rate [rate]               Adjusts the message send rate
    -h, --help                      output usage information

Setup

  1. Install node.js.
  2. Run npm install.
  3. Run npm build.
  4. Follow the below examples commands.

Examples

Convert an Apache web server log file to CSV.

node dist/index.js --file /Users/ibmcloud/Downloads/NASA_access_log_Jul95 --parser httpd --csv --out-file /Users/ibmcloud/Downloads/NASA_access_log_Jul95.csv

Stream an Apache web server log file to Message Hub.

node dist/index.js --file /Users/vanstaub/Downloads/NASA_access_log_Jul95 --parser httpd --broker-list "kafka02-prod02.messagehub.services.us-south.bluemix.net:9093" --api-key 0ErVFpnxvRqdfsSDDWQjymc1sdfDF7iRfGsvSv3cp2OOlJ4m --topic webserver --rate 100

NASA's sample HTTP web server file Jul 01 to Jul 31, ASCII format, 20.7 MB gzip compressed can be used to get started.

Customizing

To read custom log files, do the following.

  1. Create a new /parser/my-parser.ts file that implements Parser.
  2. Add the new parser as named export in Parsers.ts.
  3. Update getParser() in index.ts to define a new alias for your parser.
  4. Run npm build.
  5. Run node dist/index.js --parser my-new-parser ....

kafka-log-simulator's People

Contributors

l2fprod avatar van-ibm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.