| 1 |
.\" |
| 2 |
.\" Argus-5.0 Software |
| 3 |
.\" Copyright (c) 2000-2024 QoSient, LLC |
| 4 |
.\" All rights reserved. |
| 5 |
.\" |
| 6 |
.\" |
| 7 |
.TH RASTREAM 1 "12 August 2023" "rastream 5.0.3" |
| 8 |
.SH NAME |
| 9 |
\fBrastream\fP \- stream block processor for \fBargus(8)\fP data. |
| 10 |
.SH SYNOPSIS |
| 11 |
.B rastream |
| 12 |
[[\fB\-M\fP \fIsplitmode\fP] [\fIsplitmode options\fP]] |
| 13 |
[\fB\-f\fP \fIfile processing program\fP -B secs] |
| 14 |
[\fBraoptions\fP] [\fB--\fP \fIfilter-expression\fP] |
| 15 |
.SH DESCRIPTION |
| 16 |
.IX "rastream command" "" "\fBrastream\fP \(em argus data" |
| 17 |
.LP |
| 18 |
\fBRastream\fP reads |
| 19 |
.BR argus |
| 20 |
data from an \fIargus-data\fP source, and splits the resulting |
| 21 |
output into consecutive sections of records based on size, count |
| 22 |
time, or flow event, writing the output into a set of output-files. |
| 23 |
|
| 24 |
\fBRastream\fP provides the option to run a program against the output |
| 25 |
files, \fBseconds\fP after the file is understood to be finished. |
| 26 |
The program must be specified in a manner so that \fBrastream\fP can |
| 27 |
find it, either within the system $PATH, or provided as a full pathname. |
| 28 |
|
| 29 |
By default, \fBrastream\fP splits the stream by output file record |
| 30 |
count, putting 10,000 records of input into each \fBargus\fP output |
| 31 |
file, or standard out, as needed. The behavior is similar to the |
| 32 |
unix split.1 command. |
| 33 |
|
| 34 |
The output files' name consists of a prefix, which is specified using |
| 35 |
the \fI-w\fP \fIra option\fP, and a suffix, which is created for each |
| 36 |
resulting file. If no prefix is provided, then \fBrastream\fP will |
| 37 |
use 'x' as the default prefix. The suffix that is used is determined |
| 38 |
by the mode of operation. When \fBrastream\fP is using the default |
| 39 |
count mode or the size mode, the suffix is a group of letters 'aa', |
| 40 |
\'ab\', and so on, such that concatenating the output files in sorted |
| 41 |
order by file name produces the original input file. If \fBrastream\fP |
| 42 |
will need to create more output files than are allowed by the default |
| 43 |
suffix strategy, more letters will be added, in order to accomodate |
| 44 |
the needed files. When the mode is \fBtime\fP mode, the default |
| 45 |
output filename suffix is '%Y.%m.%d.%h.%m.%s', which is used by |
| 46 |
strftime() to create an output filename that is time oriented. |
| 47 |
This default is overrided by adding a '%' extension to the name |
| 48 |
provided on the commandline using the \fI-w\fP option. |
| 49 |
|
| 50 |
When standard out is specified, using \fI-w -\fP, \fBrastream\fP |
| 51 |
will output a single \fBargus-stream\fP with START and STOP argus management |
| 52 |
records inserted appropriately to indicate where the output is split. |
| 53 |
See \fBargus(8)\fP for more information on output stream formats. |
| 54 |
|
| 55 |
When \fBrastream\fP is spliting on output record count (the default), the |
| 56 |
number of records is specified as an ordinal counter, the default is |
| 57 |
10,000 records. When \fBrastream\fP is spliting based on the maximum output |
| 58 |
file size, the size is specified as bytes. The scale of the bytes can be |
| 59 |
specified by appending 'b', 'k' and 'm' to the number provided. |
| 60 |
|
| 61 |
When \fBrastream\fP is spliting based on time, the time period is specified |
| 62 |
with the option, and can be any period based in seconds (s), minutes (m), |
| 63 |
hours (h), days (d), weeks (w), months (M) or years (y). \fBRastream\fP |
| 64 |
will create and modify records as required to split on prescribed time |
| 65 |
boundaries. If any record spans a time boundary, the record is split |
| 66 |
and the metrics are adjusted using a uniform distribution model to |
| 67 |
distribute the statistics between the two records. Care is taken to |
| 68 |
avoid records with zero packet and byte counts, that could result |
| 69 |
from roundoff error. |
| 70 |
|
| 71 |
When \fBrastream\fP is spliting based on flow event, the flow that acts |
| 72 |
as the event marker is specified using a standard \fBra\fP filter |
| 73 |
expression, that is bounded by quotes ("). Records that preceed the |
| 74 |
first flow event in the data stream are written to the specified |
| 75 |
output file, and then new files are generated with the flow event |
| 76 |
record being the first record of the new file. This method will allow |
| 77 |
you to use wire events as triggers for spliting data. |
| 78 |
|
| 79 |
.SH RASTREAM SPECIFIC OPTIONS |
| 80 |
Rastream, like all ra based clients, supports |
| 81 |
a number of \fBra options\fP including remote data access, reading |
| 82 |
from multiple files and filtering of input argus records through a |
| 83 |
terminating filter expression. |
| 84 |
\fBrastream(1)\fP specific options are: |
| 85 |
.TP 4 4 |
| 86 |
.BI \-a "\| suffix length\^" |
| 87 |
Starting append suffix length. The default is 2 characters. |
| 88 |
.TP 4 4 |
| 89 |
.BI \-B "\| duration\^" |
| 90 |
Buffer hold time before processing. This value is usually in |
| 91 |
the 5-15 second range and provides time for rastream to sort records |
| 92 |
and schedule outputfile processing. The number is derived from the |
| 93 |
larges FAR status interval of all the argus data sources encountered. |
| 94 |
|
| 95 |
.TP 4 4 |
| 96 |
.BI \-f "\| program\^" |
| 97 |
Post processing program. \fBrastream\fP, will execute this program |
| 98 |
just after closing the output file, passing the full path to the |
| 99 |
closed output file as a parameter, using this convention: |
| 100 |
.nf |
| 101 |
|
| 102 |
program -r /full/path/to/closed/file |
| 103 |
|
| 104 |
.fi |
| 105 |
This allows you to post-process the output file in an automated fashion. |
| 106 |
|
| 107 |
Generally, this program can do anything you like, such as aggregating |
| 108 |
and correcting flow records, labeling records for semantic enhancement, |
| 109 |
indexing the files, using programs like rasqltimeindex(), and compressing |
| 110 |
the files. Traditionally, the program has been a shell-script, perl |
| 111 |
program, or php script, so that it can be easily modified, on the fly, |
| 112 |
but it can be any executable that can handle the "-r filename" parameter |
| 113 |
convention. The program should provides its own accountability and |
| 114 |
error logging, so that you know that things are working as you expect. |
| 115 |
|
| 116 |
\fBrastream\fP must have a path to the program, the program must be |
| 117 |
executable, and \fBrastream\fP must have permission to run the program |
| 118 |
for this strategy to be successful. |
| 119 |
|
| 120 |
An example rastream.sh is provided in the ./support/Config directory. |
| 121 |
|
| 122 |
.TP 4 4 |
| 123 |
.BI \-M "\| splitmode\^" |
| 124 |
Supported spliting modes are: |
| 125 |
.nf |
| 126 |
\fB count <num>\fP |
| 127 |
\fB size <size>\fP |
| 128 |
\fB time <period>\fP |
| 129 |
\fB flow "filter-expression"\fP |
| 130 |
.fi |
| 131 |
.TP 4 4 |
| 132 |
.BI \-M "\| lock[=nonblock]\^" |
| 133 |
\fBRastream\fP has additional functionality for file locking. |
| 134 |
If the lock mode is "nonblock", a failed lock results in rastream writing |
| 135 |
to a temporary file, instead. |
| 136 |
When all input has been processed the temporary files are addressed. |
| 137 |
For each temporary file rastream again attempts to lock the intended |
| 138 |
output file, but this time it blocks until the file is available. |
| 139 |
The contents of the temporary file are appended to the target file and |
| 140 |
the temporary file removed. |
| 141 |
No guarantees are made that the resulting output file contains all |
| 142 |
records in start-time order and additional processing may be required. |
| 143 |
|
| 144 |
Multiple instances of rastream can concurrently request locks for the |
| 145 |
same set of files, but in different orders, resulting in deadlock. |
| 146 |
Non-blocking locks address the deadlock scenario. |
| 147 |
The blocking locks used during cleanup are aquired singly, avoiding |
| 148 |
any opportunity for deadlock, and in the vast majority of cases will be |
| 149 |
aquired for a small subset of output files. |
| 150 |
.TP 4 4 |
| 151 |
.BI \-w "\| filename\^" |
| 152 |
\fBRastream\fP supports an extended \fI-w\fP option that allows for |
| 153 |
output record contents to be inserted into the output filename. |
| 154 |
Specified using '$' (dollar) notation, any printable field can be used. |
| 155 |
Care should be taken to honor any shell escape requirements when |
| 156 |
specifying on the command line. See \fBra(1)\fP for the list of |
| 157 |
printable fields. |
| 158 |
|
| 159 |
Another extended feature, when using \fBtime\fP mode, \fBrastream\fP |
| 160 |
will process the supplied filename using \fBstrftime(3)\fP, so that |
| 161 |
time fields can be inserted into the resulting output filename. |
| 162 |
|
| 163 |
.SH INVOCATION |
| 164 |
This invocation reads \fBargus(8)\fP data from \fBinputfile\fP and splits |
| 165 |
the \fBargus(8)\fP data stream based on output file size of no greater |
| 166 |
than 1 Megabyte. The resulting output files have a prefix of \fIargus.\fP |
| 167 |
and suffix that starts with 'aa'. The single trailing '.' is significant. |
| 168 |
.nf |
| 169 |
|
| 170 |
\fBrastream\fP -r inputfile -M size 1m -w argus. |
| 171 |
|
| 172 |
.fi |
| 173 |
|
| 174 |
This invocation splits \fBinputfile\fP based on hard 10 minute time boundaries. |
| 175 |
The resulting output files are created with a prefix of \fI/archive/%Y/%m/%d/argus.\fP |
| 176 |
and the suffix is \fI%H.%M.%S\fP. The values will be supplied based on the time in |
| 177 |
the record being written out. |
| 178 |
.nf |
| 179 |
|
| 180 |
\fBrastream\fP -r * -M time 10m -w "/archive/%Y/%m/%d/argus.%H.%M.%S" |
| 181 |
|
| 182 |
.fi |
| 183 |
|
| 184 |
This invocation splits \fBinputfile\fP based on the argus source identifier. |
| 185 |
The resulting output files are created with a prefix of \fI/archive/Source Identifier/argus.\fP |
| 186 |
and the default suffix starting with "aa". The source identifier will be |
| 187 |
supplied based on the contents of the record being exported. |
| 188 |
.nf |
| 189 |
|
| 190 |
\fBrastream\fP -r * -M time 10m -w "/archive/$srcid/argus." |
| 191 |
|
| 192 |
.fi |
| 193 |
This invocation splits \fBinputfile\fP based on a flow event marker. |
| 194 |
The resulting output files are created with a prefix of 'outfile.' and |
| 195 |
the default suffix starting with "aa". Whenever a ping to a specific |
| 196 |
host is seen in the stream, a new output file is generated. |
| 197 |
.nf |
| 198 |
|
| 199 |
\fBrastream\fP -r * -M flow "echo and host 1.2.3.4" -w outfile. |
| 200 |
|
| 201 |
.fi |
| 202 |
.SH COPYRIGHT |
| 203 |
Copyright (c) 2000-2024 QoSient. All rights reserved. |
| 204 |
|
| 205 |
.SH SEE ALSO |
| 206 |
.BR ra(1), |
| 207 |
.BR rarc(5), |
| 208 |
.BR argus(8), |
| 209 |
|
| 210 |
.SH AUTHORS |
| 211 |
.nf |
| 212 |
Carter Bullard ([email protected]). |
| 213 |
.fi |