The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
================================================================================
==================== Install from tarball ======================================
================================================================================

Grab the tarbal from github or from technofetish and untar it.

% wget http://technofetish.net/recs.tar.gz
% tar -xzvf recs.tar.gz

Then run a script!

% RecordStream/bin/recs-fromps

================================================================================
==================== Install from github =======================================
================================================================================

Best way to get recent code is use apt-get with git clone from github. (Manual Install below)

1. sudo apt-get install libdbd-sqlite3-perl sqlite3 libxml-simple-perl libproc-processtable-perl libdate-manip-perl libtext-csv-perl gnuplot libnetpacket-perl libnet-pcap-perl libnet-dns-perl libjson-perl libtext-autoformat-perl
2. git clone from github

================================================================================
==================  Easiest Install - PPA ======================================
================================================================================

Add the RecordStream ppa to your sources and pull with apt.  Only works on
apt-powered systems

% sudo add-apt-repository ppa:ppa-j/recordstream
% sudo apt-get update
% sudo apt-get install libapp-recordstream-perl

If you do not have add-apt-repository install this package:

python-software-properties

This install will allow you to keep up to date with any recent version releases

Alternatively, you can add the src directly to /etc/apt/sources.list these
lines:

  deb http://ppa.launchpad.net/ppa-j/recordstream/ubuntu natty main 
  deb-src http://ppa.launchpad.net/ppa-j/recordstream/ubuntu natty main

Then run update and install:

% sudo apt-get update
% sudo apt-get install libapp-recordstream-perl

================================================================================
==================  Almost Easiest Install - .deb ==============================
================================================================================

This will download the prepped .deb file and install the dependencies you need

% wget http://technofetish.net/libapp-recordstream.deb
% sudo dpkg -i libapp-recordstream.deb
% sudo apt-get -f install

See the getting started guide below for starting to use RecordStream!

Once that is done, you might want to check out aRecordStreamStory in this
directory.  A humorus introduction to a simple use of RecordStream.

================================================================================
==================  Easy Install - CPAN    =====================================
================================================================================

% sudo perl -MCPAN -e shell
> install App::RecordStream::Operation

Then answer all the many many prompts.

See the getting started guide below for starting to use RecordStream!

Once that is done, you might want to check out aRecordStreamStory in this
directory.  A humorus introduction to a simple use of RecordStream.

================================================================================
==================  Manual Install          ====================================
================================================================================

To use this package, put bin on your path and libs in your PERL5LIB env
variable.  Also install the dependencies listed below.  ./tester.pl should run
with no errors if everything is working.

First download all the source (available from http://github.com/benbernard/RecordStream)

Then you'll need some packages:

Ubuntu packages:
  libdbd-sqlite3-perl
  sqlite3
  libxml-simple-perl
  libproc-processtable-perl
  libdate-manip-perl
  libtext-csv-perl
  gnuplot
  libnetpacket-perl
  libnet-pcap-perl
  libnet-dns-perl
  libjson-perl
  libtext-autoformat-perl

you can install these with:

% sudo apt-get install libdbd-sqlite3-perl sqlite3 libxml-simple-perl libproc-processtable-perl libdate-manip-perl libtext-csv-perl gnuplot libnetpacket-perl libnet-pcap-perl libnet-dns-perl libjson-perl libtext-autoformat-perl

----

Once that is done, you might want to check out aRecordStreamStory in this
directory.  A humorus introduction to a simple use of RecordStream.

Some Examples you can run right now:

1. First setup your path and perl5lib:

(from the recordstream directory)

export PATH=$PATH:`pwd`/bin && export PERL5LIB=$PERL5LIB:`pwd`/libs

================================================================================
==================  Getting Started with RecordStream ==========================
================================================================================

EXAMPLE 1:
How many processes are each of the users on my system running?

recs-fromps | recs-collate --key uid -a count | recs-sort --key count=n | recs-totable

Broken down this is:
1. recs-fromps - First get the records of all the prcesses currently running
2. recs-collate --key uid -a count
     Grouping by the uid field, count how many records fall into the group
3. recs-sort --key count=n 
     Sort the resulting records by the count key
     numerical (rather than lexically)
4. recs-totable - Print the output in a nicely formatted table.

EXAMPLE 2:
How many processes are each user on the system running at each priority level?

recs-fromps | recs-collate --key uid,priority -a count | recs-toptable --x priority --y uid --v count

Broken down:
1. recs-fromps - First get the records of all the prcesses currently running
2. recs-collate --key uid,priority -a count
     Grouping by the uid and the priority field, count how many records fall
     into the group
3. recs-toptable --x priority --y uid -v count
     Create a 2 dimensional table, across the top put the priority values, down
     the side put the uid.  In put the value of the count field in the cell

EXAMPLE 3:
What Xorg modules put information in my Xorg.log at startup, and what log level
are they logged at?  I need this in csv format for importing into a spreadsheet
program.

recs-frommultire --re 'type,module=\((\S*)\) ([^:]+):' /var/log/Xorg.0.log | recs-collate --key type,module -a ct | recs-sort --key ct=n | recs-tocsv --header

1. recs-frommultire --re 'type,module=\((\S*)\) ([^:]+):' /var/log/Xorg.0.log 
     Parse out the type and module from the Xorg log file.  That regex reads
     capture text inside literal '()', then capture text after a space up to the
     first ':'.
2. recs-collate --key type,module -a ct
     Collate records into groups of type-modules.  Count how many in each group
     across all records.
3. recs-sort --key ct=n 
     Sort by the count, numerically.
4. recs-totable --spreadsheet --delim ','
     Output a table in spreadsheet format (no ASCII art), delimited by commas
     instead of tabs