Giter Site home page Giter Site logo

ssh-tail's Introduction

ssh-tail

This project is one of the problems that I generally face while debugging some system. When I am reproducing the issue on the machine i also want to tail the logs side-by-side to see the error. This becomes cumbersome when i need to fetch multiple log files or use them for future purpose or constantly hop between dashboards, script and machine for the session.

To solve this comes ssh-tail. It is a binary to tail log files from remote ssh machines and store them locally into your system for debugging or storage purpose. It is controlled by a JSON config which saves me time of creating multiple ssh-session either using a window managers or some bash script which does that for me. Logic for creating new filenames based on the unique flag.

It assumes that you have an unecrypted private key and present in your home folder inside an .ssh folder and ssh-agent is running on your machine.

To use ssh-tail you need to set and env variable while running the process SSH_TAIL_CONFIG which will pick the json config to use for the ssh session.

Sinks

Sinks are the interfaces which will be used to dump the data fetched from the ssh session running on the remote machine. These sinks can be local file system or an external service like S3. For now the implementation is only made for the local file system but later S3 or any plugin can be included.

Usage

SSH_TAIL_CONFIG="ssh_tunnel.json" make

Example cofig file:

{
  "host": "machine_ip",
  "port": int_port_number,
  "username": "username",
  "commands": [
    {
      "command": "command_1",
      "file": "file_1"
    },
    {
      "command": "command_2",
      "file": "file_2"
    }
    ...
  ]
}

For use with machines that are behind a proxy:

{
  "host": "target_machine_ip",
  "port": target_machine_port,
  "username": "username",
  "proxyConfig": {
    "host": "proxy_machine_ip / hop_ip",
    "port": proxy_jump_machine_port,
    "username": "proxy_jump_username"
  },
  "commands": [
    {
      "command": "command_1",
      "file": file_1
    }
    ...
  ]
}

Building locally

You can build the binary locally using the following command.

make build

This will generate build files for targets (windows, linux and darwin).

Development / Contribution

This is just a binary that i created for myself to ease my workflow. In case you also face similar issues or want to solve some existing issue, feel free to dive right in and send a patch my way. I would be happy to review your patch.

To test out the changes locally you can use the following command.

SSH_TAIL_CONFIG="ssh_tunnel.json" make

ssh-tail's People

Contributors

yashladha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.