Git Product home page Git Product logo

dasp's Introduction

Dasp (Data Spider)

This bash script is provides get data for any period from different text sources separated into fields, one or more of which contains date/time. Such as Apache server logs, /etc/syslogs, json data source and others. Script may work with gz, may compare dates without leading zeros, with custom months, without years, separated in similar fields, etc.

Usage

Usage of this script is explained by the example for Apache server access logs. Usage for other popular data sources see below in section "Most common aliases"

Install

git clone https://github.com/ans-hub/dasp.git

Make script executable:

$ chmod +x dasp

Make symbolic link to script

$ sudo ln -s ~/folder_with_dasp_app/dasp /usr/local/bin/dasp

Note: in next steps all code writed without "./", as if you have performed command above.

Read built-in help for command usage:

$ dasp -h

Build options for script and test it in shell:

$ dasp -s logs/ -f "*access*log" -d " " -w "[%Y-%b-%d:%H:%M:%S" -k 4 -o 1 -t /tmp/.dasp~ "yestarday" "now"

If get of data has ended successfully, set it to the alias:

$ alias apache_access="dasp -s logs/ -f "*access*log" -d " " -w "[%Y-%b-%d:%H:%M:%S" -k 4 -o 1 -t /tmp/.dasp~"

Usage examples:

$ apache_access "yesterday"
$ apache_access "yesterday 14:00:05" "today 12:00"
$ apache_access "2008" "2010" 1> ~/.apache_2008_2010

Another way to use dasp is create wrapper script

In this case usage of dasp is more pretty:

$ ./wrapper "2 days ago" "yesterday" own_filter_1 own_filter_2

For example, https://github.io/ans-hub/osvalt - old-school viewer: apache log tool (wrapper to the dasp)

Most common data source

Apache logs

$ dasp -s logs/ -f "*access*" -d " " -w "[%Y-%b-%d:%H:%M:%S" -k 4 -o 1

Syslogs

$ dasp -s /var/log/ -f "syslog.*" -d " " -w "%b %-d %H:%M:%S" -k "1&2&3"

Your own data sources:

$ dasp -h

More data source examples:

Examples with different mock data source you may find in test case script "dasp_test_main"

Recemmendations:

Use -t option to improve perfomance

Known issues:

Getting logs without years in log line (such as syslog) is realised, but there is no way in this version to compare logs for different years period. This feature will have been realised in future version.

Current version not work with logs that contains milliseconds.

Current version not working with time zones

dasp's People

Contributors

ans-hub avatar

Stargazers

 avatar

Watchers

 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.