|
NAMErwtotal - Count how much traffic matched specific keysSYNOPSISrwtotal {--sip-first-8 | --sip-first-16 | --sip-first-24 | --sip-last-8 | --sip-last-16 | --dip-first-8 | --dip-first-16 | --dip-first-24 | --dip-last-8 | --dip-last-16 | --sport | --dport | --proto | --packets | --bytes | --duration | --icmp-code} [--summation] [--min-bytes=COUNT] [--max-bytes=COUNT] [--min-packets=COUNT] [--max-packets=COUNT] [--min-records=COUNT] [--max-records=COUNT] [--skip-zeroes] [--no-titles] [--no-columns] [--column-separator=CHAR] [--no-final-delimiter] [{--delimited | --delimited=CHAR}] [--print-filenames] [--copy-input=PATH] [--output-path=PATH] [--pager=PAGER_PROG] [--site-config-file=FILENAME] {[--xargs] | [--xargs=FILENAME] | [FILE [FILE ...]]} rwtotal --help rwtotal --version DESCRIPTIONrwtotal reads SiLK Flow records, bins those records by the user-specified specified key, computes the volume per bin (record count and sums of packets and bytes), and prints the bins and their volumes.rwtotal reads SiLK Flow records from the files named on the command line or from the standard input when no file names are specified and --xargs is not present. To read the standard input in addition to the named files, use "-" or "stdin" as a file name. If an input file name ends in ".gz", the file is uncompressed as it is read. When the --xargs switch is provided, rwtotal reads the names of the files to process from the named text file or from the standard input if no file name argument is provided to the switch. The input to --xargs must contain one file name per line. By default, rwtotal prints a bin for every possible key, even when the volume for that bin is zero. Use the --skip-zeroes switch to suppress the printing of these empty bins. Use the --summation switch to include a row giving the volume for all flow records. The maximum key value that rwtotal supports is 16,777,215. When the key field is --bytes or --packets, rwtotal will create a bin for all unique values up to 16,777,214. The final bin (16,777,215) will consist of all values greater than 16,777,214. OPTIONSOption names may be abbreviated if the abbreviation is unique or is an exact match for an option. A parameter to an option may be specified as --arg=param or --arg param, though the first form is required for options that take optional parameters.One and only one of the following counting keys is required:
The following options affect the output:
EXAMPLESIn the following examples, the dollar sign ("$") represents the shell prompt. The text after the dollar sign represents the command line. Lines have been wrapped for improved readability, and the back slash ("\") is used to indicate a wrapped line.Group by the protocolGroup all incoming data for the first hour of March 1, 2003 by protocol.$ rwfilter --start-date=2003/03/01:00 --end-date=2003/03/01:00 \ --all-destination=stdout \ | rwtotal --proto --skip-zero protocol| Records| Bytes| Packets| 1| 15622| 10695328| 147084| 6| 330726| 120536195111| 144254362| 17| 155528| 24500079| 155528| To get the same result with rwuniq(1), use: $ rwfilter ... --pass=stdout \ | rwuniq --fields=proto --values=records,bytes,packets \ --sort-output pro| Records| Bytes| Packets| 1| 15622| 10695328| 147084| 6| 330726| 120536195111| 144254362| 17| 155528| 24500079| 155528| Group by the source Class A addresses$ rwfilter --start-date=2003/03/01:00 --end-date=2003/03/01:00 \ --all-destination=stdout \ | rwtotal --sip-first-8 --skip-zero sIP_First8| Records| Bytes| Packets| 10| 173164| 59950837766| 72201390| 172| 77764| 17553593| 77764| 192| 250948| 60602999159| 72277820| Use rwnetmask(1) and rwuniq(1) to get a similar result: $ rwfilter ... --pass=stdout \ | rwnetmask --4sip-prefix=8 \ | rwuniq --fields=sip --values=records,bytes,packets \ --sort-output --ipv6-policy=ignore sIP| Records| Bytes| Packets| 10.0.0.0| 173164| 59950837766| 72201390| 172.0.0.0| 77764| 17553593| 77764| 192.0.0.0| 250948| 60602999159| 72277820| Group by the final IPv4 octet$ rwfilter --start-date=2003/03/01:00 --end-date=2003/03/01:00 \ --proto=6 --pass=stdout --daddress=192.168.x.x \ | rwtotal --dip-last-16 --skip-zero | head -5 dIP_Last16| Records| Bytes| Packets| 0. 38| 6| 4862678| 4016| 1. 14| 1| 32844| 452| 18.146| 1| 4226| 12| 21. 4| 6| 5462032| 4521| One way to accomplish this with rwuniq is to create a new field using PySiLK (see pysilk(3)) and the PySiLK plug-in capability (see silkpython(3). The invocation is: $ rwfilter ... --pass=stdout \ | rwuniq --python=/tmp/dip16.py --fields=dip-last-16 \ --values=flows,bytes,packets --sort-output | head -5 dip-last-16| Records| Bytes| Packets| 0.0.0.38| 6| 4862678| 4016| 0.0.1.14| 1| 32844| 452| 0.0.18.146| 1| 4226| 12| 0.0.21.4| 6| 5462032| 4521| where the definition of the "dip-last-16" field is given in the file tmp/dip16.py: import silk mask = silk.IPAddr("0.0.255.255") def mask_dip(r): return r.dip.mask(mask) register_ipv4_field("dip-last-16", mask_dip) ENVIRONMENT
FILES
SEE ALSOrwaddrcount(1), rwnetmask(1), rwstats(1), rwuniq(1), pysilk(3), silkpython(3), silk(7)BUGSrwtotal replicates some functionality in rwuniq(1) (most notably when rwuniq checks by port or protocol), but the implementations differ: rwtotal uses an array instead of a hash-table, so access is faster, the output is always sorted, and the output includes keys with a value of zero. The use of an array prevents rwtotal from using the complete IP address the way rwuniq does, but it also ensures that rwtotal will not run out of memory.When used in an IPv6 environment, rwtotal will process every record as long as the IP address is not part of the key. When aggregating by the IP address, rwtotal converts IPv6 flow records that contain addresses in the ::ffff:0:0/96 prefix to IPv4 and processes them. IPv6 records having addresses outside of that prefix are silently ignored. rwtotal will not be modified to support IPv6 addresses; instead, users should use rwuniq(1) (maybe combined with rwnetmask(1)). rwtotal is also similar to rwaddrcount(1) and rwstats(1).
Visit the GSP FreeBSD Man Page Interface. |