GithubHelp home page GithubHelp logo

kilianc / rtail Goto Github PK

View Code? Open in Web Editor NEW
1.6K 38.0 107.0 943 KB

rtail(1) - Terminal output to the browser in seconds, using UNIX pipes.

Home Page: http://rtail.org

JavaScript 32.62% HTML 16.52% Shell 16.21% CSS 34.65%

rtail's Introduction

rtail(1)

Wercker CI Coveralls NPM version NPM downloads GitHub Stars License Gitter

Terminal output to the browser in seconds, using UNIX pipes.

rtail is a command line utility that grabs every line in stdin and broadcasts it over UDP. That's it. Nothing fancy. Nothing complicated. Tail log files, app output, or whatever you wish, using rtail broadcasting to an rtail-server – See multiple streams in the browser, in realtime.

Installation

$ npm install -g rtail

Web app

Rationale

Whether you deploy your code on remote servers using multiple environments or simply have multiple projects, you must ssh to each machine running your code, in order to monitor the logs in realtime.

There are many log aggregation tools out there, but few of them are realtime. Most other tools require you to change your application source code to support their logging protocol/transport.

rtail is meant to be a replacement of logio, which isn't actively maintained anymore, doesn't support node v0.12., and uses TCP. (TCP requires strict client / server handshaking, is resource-hungry, and very difficult to scale.)

The rtail approach is very simple:

  • pipe something into rtail using UNIX I/O redirection [2]
  • broadcast every line using UDP
  • rtail-server, if listening, will dispatch the stream into your browser, using socket.io.

rtail is a realtime debugging and monitoring tool, which can display multiple aggregate streams via a modern web interface. There is no persistent layer, nor does the tool store any data. If you need a persistent layer, use something like loggly.

Examples

In your app init script:

$ node server.js 2>&1 | rtail --id "api.myproject.com"

$ mycommand | rtail > server.log

$ node server.js 2>&1 | rtail --mute

Supports JSON5 lines:

$ while true; do echo [1, 2, 3, "hello"]; sleep 1; done | rtail
$ echo { "foo": "bar" } | rtail
$ echo { format: 'JSON5' } | rtail

Using log files (log rotate safe!):

$ node server.js 2>&1 > log.txt
$ tail -F log.txt | rtail

For fun and debugging:

$ cat ~/myfile.txt | rtail
$ echo "Server rebooted!" | rtail --id `hostname`

Params

$ rtail --help
Usage: cmd | rtail [OPTIONS]

Options:
  --host, -h     The server host                 [string] [default: "127.0.0.1"]
  --port, -p     The server port                        [string] [default: 9999]
  --id, --name   The log stream id                 [string] [default: (moniker)]
  --mute, -m     Don't pipe stdin with stdout                          [boolean]
  --tty          Keeps ansi colors                     [boolean] [default: true]
  --parse-date   Looks for dates to use as timestamp   [boolean] [default: true]
  --help         Show help                                             [boolean]
  --version, -v  Show version number                                   [boolean]

Examples:
  server | rtail > server.log         localhost + file
  server | rtail --id api.domain.com  Name the log stream
  server | rtail --host example.com   Sends to example.com
  server | rtail --port 43567         Uses custom port
  server | rtail --mute               No stdout
  server | rtail --no-tty             Strips ansi colors
  server | rtail --no-date-parse      Disable date parsing/stripping

rtail-server(1)

rtail-server receives all messages broadcast from every rtail client, displaying all incoming log streams in a realtime web view. Under the hood, the server uses socket.io to pipe every incoming UDP message to the browser.

There is little to no configuration – The default UDP/HTTP ports can be changed, but that's it.

Examples

Use default values:

$ rtail-server

Always use latest, stable webapp:

$ rtail-server --web-version stable

Use custom ports:

$ rtail-server --web-port 8080 --udp-port 9090

Set debugging on:

$ DEBUG=rtail:* rtail-server

Open your browser and start tailing logs!

Params

$ rtail-server --help
Usage: rtail-server [OPTIONS]

Options:
--udp-host, --uh  The listening UDP hostname            [default: "127.0.0.1"]
--udp-port, --up  The listening UDP port                       [default: 9999]
--web-host, --wh  The listening HTTP hostname           [default: "127.0.0.1"]
--web-port, --wp  The listening HTTP port                      [default: 8888]
--web-version     Define web app version to serve                     [string]
--help, -h        Show help                                          [boolean]
--version, -v     Show version number                                [boolean]

Examples:
rtail-server --web-port 8080         Use custom HTTP port
rtail-server --udp-port 8080         Use custom UDP port
rtail-server --web-version stable    Always uses latest stable webapp
rtail-server --web-version unstable  Always uses latest develop webapp
rtail-server --web-version 0.1.3     Use webapp v0.1.3

UDP Broadcasting

To scale and broadcast on multiple servers, instruct the rtail client to stream to the broadcast address. Every message will then be delivered to all servers in your subnet.

Authentication layer

For the time being, the webapp doesn't have an authentication layer; it assumes that you will run it behind a VPN or reverse proxy, with a simple Authorization header check.

How to contribute

This project follows the awesome Vincent Driessen branching model.

  • You must add a new feature on its own branch
  • You must contribute to hot-fixing, directly into the master branch (and pull-request to it)

This project uses JSCS to enforce a consistent code style. Your contribution must be pass jscs validation.

The test suite is written on top of mochajs/mocha. Use the tests to check if your contribution breaks some part of the library and be sure to add new tests for each new feature.

$ npm test

Contributors

Roadmap (aka where you can help)

  • Write a rock solid test suite
  • Allow use of DTLS (waiting for node to support this nodejs/node-v0.x-archive#6704)
  • Add GitHub OAuth and basic auth for teams (join proposal convo here: #44)
  • Implement infinite-scroll like behavior in the webapp to support bigger backlogs and make it future proof.
  • Publish base rtail docker image to DockerHub
  • Create a catch all docker logs image
  • Rewrite webapp using ng2

Sponsors

❤ rTail? Consider sponsoring this project to keep it alive and free for the community.

  • Lukibear (domain)
  • ? (wildcard TLS cert)
  • ? (.io domain)

PayPal donate button

Professional support or ad-hoc is also available.

License

This software is released under the MIT license cited below.

Copyright (c) 2014 Kilian Ciuffolo, [email protected]. All Rights Reserved.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

rtail's People

Contributors

kilianc avatar timriot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtail's Issues

add github signin integration

We should add a OAuth integration for organizations and personal account as basic authorization layer for the webapp and websocket.

Rancher UI has a similar approach were they ask you to setup it up on first spin-up. Since there is no storage layer it's still unclear how to make this happen.

I guess writing a file in rtail-server cwd would work.

Support grep color format

Hi!

I'm having fun playing with rtail but I want to use it to monitor scripts that use grep to colorize their output and it doesn't seem to work well with rtail.
To reproduce, the following command should display 'lol' in red in the terminal but not in the rtail UI.

$ echo lol | grep --color=always lol | rtail --id test_grep

This is the format that grep uses:

$ echo lol | grep --color=always lol | cat -e
^[[01;31m^[[Klol^[[m^[[K$

I'm not sure if this is more of an ansi_up issue, or if there are some GREP_COLORS options I could set to fix it.

Thank you for your help and for building something cool!

connect favoriting UI directly to stream list

Presently, the favorite UI / process is disconnected from the list of streams. Adding favorite stars to the onHover of stream list items will create a more coherent mental connection.

Also, the favorites title should be removed when there are no favorites.

Not getting all streamed info

I am streaming an IRC session with ii to my rtail server like so:

sg:~/irc/irc.freenode.net/#hackerspacesg$ tail -F out | rtail --id hsg --host sg.dabase.com
2015-07-09 15:33 -!- iilogbot([email protected]) has joined #hackerspacesg
2015-07-09 15:34 <hendry> another test
2015-07-09 15:34 <hendry> http://sg.dabase.com:8888/#hsg
2015-07-09 15:34 <WantonMee> [ rTail : loading ... ] - sg.dabase.com:8888

However it looks like this:

It's missing the nick info <hendry> and duplicating the timestamp. Am I not using the right option?

XSS Issue

Any code in the content field get evaluated.

[  
   "line",
   {  
      "timestamp":0000000000000,
      "streamid":"rtail.org",
      "host":"XXX.XXX.XXX.XXX",
      "port":50049,
      "content":"<script>window.top.location.href=\"http://www.google.com\"</script>",
      "type":"string"
   }
]

This would redirect the user to http://www.google.com

Layout different in firefox

Two scrollbars are displayed in firefox (v38) when the output is longer than the screen height and the resume button doesn't appear.

rtail.org rick roll?

rtail.org seems to be redirecting to youtube (rick roll 10 hours) on page load. It's a great track, but er, I'd kinda like to see the thing in action.

parse lines for dates and use as timestamp

If the log line starts with a date we should be able to parse it and remove it. We can then serialize it as .timestamp and display it in the timestamp column in the UI.

I think we need a --parse-date and --no-parse-date flag in client.js to allow to turn it off.

make backlog size configurable

I was using this for a java log and a stacktrace was longer than the buffer. If I have the available RAM could there be an option to control the buffer size?

In the mean time is there a place I can hack this in?

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.