• Stars
    star
    291
  • Rank 141,707 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Webapp for looking at and searching through files and streams

Tailon Build Status GoDoc Go Report Card Apache License GitHub release

Tailon is a webapp for looking at and searching through files and streams. In a nutshell, it is a fancy web wrapper around the following commands:

tail -f
tail -f | grep
tail -f | awk
tail -f | sed

What sets tailon apart from other similar projects is:

  • Fully self-contained executable. Just download (or build) and run.
  • Small footprint. The tailon executable sits at 2.5MB in size and uses 10MB of RSS.
  • Responsive and minimal user-interface.

Install

Download a build for your platform from the releases page or install using go get:

go get -u github.com/gvalkov/tailon

A docker image is also available:

docker run --rm gvalkov/tailon --help

Usage

Tailon is a command-line program that starts a local HTTP server, which in turn streams the output of commands such as tail and grep. It can be configured from its command-line interface or through the convenience of a toml config file. Some options, like adding new commands, are only available through the configuration file.

To get started, run tailon with the list of files that you wish to monitor.

tailon /var/log/apache/access.log /var/log/apache/error.log /var/log/messages

Tailon can serve single files, globs or whole directory trees. Tailon’s server-side functionality is summarized entirely in its help message:

Usage: tailon -c <config file>
Usage: tailon [options] <filespec> [<filespec> ...]

Tailon is a webapp for looking at and searching through files and streams.

  -a, --allow-download         allow file downloads (default true)
  -b, --bind string            Listen on the specified address and port (default ":8080")
  -c, --config string
  -h, --help                   Show this help message and exit
  -e, --help-config            Show configuration file help and exit
  -r, --relative-root string   webapp relative root (default "/")

Tailon can be configured through a config file or with command-line flags.

The command-line interface expects one or more filespec arguments, which
specify the files to be served. The expected format is:

  [alias=name,group=name]<spec>

where <spec> can be a file name, glob or directory. The optional 'alias='
and 'group=' specifiers change the display name of the files in the UI and
the group in which they appear.

A file specifier points to a single, possibly non-existent file. The file
name in the UI can be overwritten with 'alias='. For example:

  tailon alias=error.log,/var/log/apache/error.log

A glob evaluates to the list of files that match a shell file name pattern.
The pattern is evaluated each time the file list is refreshed. An 'alias='
specifier overwrites the parent directory of each matched file in the UI.

  tailon "/var/log/apache/*.log" "alias=nginx,/var/log/nginx/*.log"

If a directory is given, all files under it are served recursively.

  tailon /var/log/apache/ /var/log/nginx/

Example usage:
  tailon file1.txt file2.txt file3.txt
  tailon alias=messages,/var/log/messages "/var/log/*.log"
  tailon -b localhost:8080,localhost:8081 -c config.toml

For information on usage through the configuration file, please refer to the
'--help-config' option.

Security

Tailon runs commands on the server it is installed on. While commands that accept a script argument (such as awk, sed and grep) should be invulnerable to shell injection, they may still allow for arbitrary command execution and unrestricted access to the filesystem.

To clarify this point, consider the following input to the sed command:

s/a/b'; cat /etc/secrets

This will result in an error, as tailon does not invoke commands through a shell. On the other hand, the following command is a perfectly valid sed script that has the same effect as the above attempt for shell injection:

r /etc/secrets

The default set of enabled commands - tail, grep and awk - should be safe to use. GNU awk is run in sandbox mode, which prevents scripts from accessing your system, either through the system() builtin or by using input redirection.

By default, tailon is accessible to anyone who knows the server address and port. Basic and digest authentication are under development.

Development

Frontend

The web interface is a written in plain ES5 with the help of some Vue.js. A simple makefile is used to bundle and compress the frontend assets. To work on the frontend, make sure you're building with the dev build tag:

go build -tags dev

This will ensure that the tailon binary is reading assets from the frontend/dist directory instead of from frontend/assets_vfsdata.go. To compile the web assets, use make all or make all BUILD=dev in case you want to simply concatenate files instead of also compressing them.

The make watch goal can be used to continuously update the bundles as you make changes to the sources.

Note that the minified frontend bundles are committed in order to avoid people wanting to work only on the backend from having to pull the full node_modules.

Backend

The backend is written in straightforward go that tries to do as much as possible using only the standard library.

Backlog

  • Directory serving is not implemented yet.

  • User-specified TOML configuration files.

  • Basic and digest authentication.

  • Add a 'command' filespec - e.g. "command,journalctl -u nginx".

  • Better configuration dialog.

  • Add interface themes - e.g. light, dark and solarized.

  • Add ability to change font family and size.

  • Windows support (can use one of the Go tail implementations).

  • Implement wtee.

  • Stderr is streamed to the client, but it is not handled at the moment.

Testing

The project has unit-tests, which you can run with go test and integration tests which you can run with cd tests; pytest. Alternatively, you can run both with make test.

The integration tests are written in Python and use pytest and aiohttp to interact with a running tailon instance. To run the integration tests, you first need to install the needed dependencies:

# Option 1: Using a virtualenv
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install -r tests/requirements.txt

# Option 2: User site-packages
python3 -m pip install --user -r tests/requirements.txt

What about the other tailon project?

This project is a full rewrite of the original tailon with the following goals in mind:

  • Reduce maintenance overhead (especially on the frontend).
  • Remove unwanted features and fix poor design choices.
  • Learn more about Go and Vue.js.

In terms of tech, the following has changed:

  • Backend from Python+Tornado to Go.
  • Frontend from a very-custom Typescript solution to a simple ES5 + Vue.js app.
  • Simplified asset pipeline (a short Makefile).
  • Config file is now toml based.
  • Fully self-contained executable.

Similar Projects

Attributions

Tailon's favicon was created from this icon.

License

Tailon is released under the terms of the Apache 2.0 License.

More Repositories

1

python-evdev

Python bindings for the Linux input subsystem
Python
317
star
2

tailon-legacy

Webapp for looking at and searching through log files
Python
192
star
3

golang-evdev

Go bindings for the linux input subsystem
Go
120
star
4

setuptools-py2cfg

Script for converting setup.py to setup.cfg
Python
70
star
5

python-ansimarkup

Produce colored terminal text with an xml-like markup
Python
63
star
6

jenkins-autojobs

Automatically create Jenkins jobs from template jobs and branches in a SCM repository
Python
49
star
7

rsstail.py

A command-line syndication feed monitor
Python
47
star
8

wtee

Webview for piped data
Python
39
star
9

python-oneliner

Module for practical Python one-liners
Python
34
star
10

gitolite-sshkey-form

Webapp for submitting ssh public keys directly to gitolite
Perl
30
star
11

xrectsel

A rectangle selection tool for X11
C
20
star
12

tornado-http-auth

Digest and basic authentication for Tornado
Python
19
star
13

git-link

Git subcommand for getting a repo-browser link to a git object
Python
17
star
14

jenkins-webapi

Python library for interacting with jenkins ci
Python
16
star
15

pyzmo

Hotkey library based on python-evdev
Python
16
star
16

olympus-photosync

List, download and sync photos from WiFi enabled Olympus cameras.
Python
12
star
17

micropython-esp8266-hmc5883l

Micropython driver for the HMC5883l on the ESP8266
Python
11
star
18

harstats-graphite

Summarize HAR files and feed them to carbon/graphite
Python
10
star
19

gifblender

blends image sequences
Shell
9
star
20

gnu-make-toolkit

Utility functions for GNU Make
Python
6
star
21

dotfiles

Vim Script
5
star
22

dotfiles-emacs

Emacs Lisp
4
star
23

python-module-launcher

Reduce startup and import times of python programs by maintaining a process pool
Python
4
star
24

ido-other-window

invoke emacs ido completion in other window
Emacs Lisp
4
star
25

olympus-photosync-server

Automatically connect to and sync photos from Olympus WiFi enabled cameras
Python
4
star
26

awesome-ezconfig

Easier key and button setup for awesome wm
Lua
3
star
27

motion-wol

motion wake-on-lan daemon that works for me
Python
2
star
28

grblcom

[wip] Rich serial-console client for the grbl CNC milling controller
Python
2
star
29

dotfiles-vim

Vim Script
2
star
30

vim-hg

[wip] Mercurial runtime files for Vim
Vim Script
1
star
31

dotfiles-spacemacs

Emacs Lisp
1
star
32

screenshots

[meta] screenshots and images used in various projects
1
star
33

python-commandpool

Functions for running many subprocesses in parallel
Python
1
star
34

collectd-graph

[wip] Command-line graphing utility for the collectd rrdtool backend
Python
1
star
35

nginx-ldap-auth-aiohttp

LDAP authentication for NGINX using auth_request and a Python daemon
Python
1
star
36

optparse-pretty

A more compact help formatter for optparse
Python
1
star
37

python-lsofgraph

Visualize lsof using graphviz (port of zevv/lsofgraph)
Python
1
star