Code Monkey home page Code Monkey logo

logrep's Introduction

logrep

A tiny log aggregation, transformation and streaming server

Logrep is a very simple, yet extremely flexible tool you can use to aggregate, transform and stream log files via http(s). In the configuration file (example below) you specify which files you want to monitor and to which http endpoints they map, optionally, passing through handlers on their way.

Configuration json file example. With this configuration, the system will start monitoring the files as specified by the 'filename' directives and will stream them to the respective endpoints:

{

	// the port the server will be listening
	"port": 3000,
	// endpoints used more than once can be grouped into templates
	"endpoint_templates" : {
		"errors_warnings":
			{
				// the network endpoint name
				"name": "errors_warnings",
				// the handler(s) data pass through to reach this endpoint. These handlers can filter and transform the 
				// data on the way
				"handlers": ["./handlers/filters/errors_warnings"]
			}
	},
	// the files we will be monitoring
	"sources": [
		{
			"filename" : "/logs/log_frontend.txt",
			"endpoints" : [ "log_frontend", "all", "all_dev", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_frontend_qa.txt",
			"endpoints" : [ "log_frontend_qa", "all", "all_qa", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_load_balancer.txt",
			"endpoints" : [ "log_load_balancer", "all", "all_dev", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_load_balancer_qa.txt",
			"endpoints" : [ "log_load_balancer_qa", "all", "all_qa", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_worker_1.txt",
			"endpoints" : [ "log_worker_1", "all", "all_dev", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_worker_1_qa.txt",
			"endpoints" : [ "log_worker_1_qa", "all", "all_qa", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_worker_2.txt",
			"endpoints" : [ "log_worker_2", "all", "all_dev", "templates.errors_warnings" ]
		},
		{
			"filename" : "/logs/log_worker_2_qa.txt",
			"endpoints" : [ "log_worker_2_qa", "all", "all_qa", "templates.errors_warnings" ]
		}
	]
}

The above file will give you the following endpoints:

http://localhost:3000/
http://localhost:3000/all
http://localhost:3000/all_qa
http://localhost:3000/all_dev
http://localhost:3000/errors_warnings
http://localhost:3000/log_load_balancer
http://localhost:3000/log_load_balancer_qa
http://localhost:3000/log_worker_1
http://localhost:3000/log_worker_1_qa
http://localhost:3000/log_worker_2
http://localhost:3000/log_worker_2_qa

Each endpoint maps to a file or a group of files, possibly transformed with handlers.

Each time a monitored log file is updated, the server will update its internal caches and will stream the new (potentially transformed or filtered) data to any currently attached listeners (browsers currently pointed at the respective URL).

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.