LOG TRACKER

 LOG TRACKER

TRACK LOG FILES THE WAY YOU WANT

Log tracker is a pythonic wrapper around paramiko, created to capture/read/tail text files using SSH. It gives you the ability to create any kind of custom python function to track text files on demand. To use this YAML file with credential data and a slight understanding about python(version 3) programming is more than enough.

file_download download LTRK-v0.1.0

TRACKING A LOG

For more guides and examples please refer Log Tracker wiki.

A YAML FILE

Log Tracker requires a YAML file with credential data and remote log file location. Below is an example YAML configuration file.


name: example
hostname: 127.0.0.1
username: SSH_USERNAME
password: SSH_PASSWORD
log: /path/to/log/file/log.txt
        

A PYTHON FUNCTION

A function mentioning what you want to do with the log file is required. For every custom function a text stream object wil be provided by the Log Tracker. Simply put your function in tasks.py


def example_function(text_stream):
    # prepare text stream object
    text_stream.load()

    # tail log file, equals to tail -f in unix
    for line in text_stream.tail():
        print(line.rstrip("\n"))
        

AN ENTRY IN TASKS LIST

Simply tell Log Tracker to use the custom function by putting a record in TASKS list in tasks_list.py


TASKS = {
    "example": tasks.example_function
}
        

All done. Now run the Log Tracker, python3 ltrk.py

GET/CONTRIBUTE LOG TRACKER

Log Tracker is a free software and heartily appreciates any kind of contribution, suggestions/issues or pull requests.

file_download RELEASES content_copy SOURCE CODE bug_report ISSUE/SUGGESTION