|
NAMErwaddrcount - count activity by IPv4 address SYNOPSIS rwaddrcount {--print-recs | --print-ips | --print-stat}
[--use-dest] [--min-bytes=BYTEMIN] [--max-bytes=BYTEMAX]
[--min-records=RECMIN] [--max-records=RECMAX]
[--min-packets=PACKMIN] [--max-packets=PACKMAX]
[--set-file=PATHNAME] [--sort-ips] [--timestamp-format=FORMAT]
[--ip-format=FORMAT] [--integer-ips] [--zero-pad-ips]
[--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]
[{--legacy-timestamps | --legacy-timestamps=NUM}]
{[--xargs] | [--xargs=FILENAME] | [FILE [FILE ...]]}
rwaddrcount --help
rwaddrcount --version
DESCRIPTIONrwaddrcount reads SiLK Flow records, sums the byte-, packet-, and record-counts on those records by individual source or destination IP address and maintains the time window during which that IP address was active. At the end of the count operation, the results per IP address are displayed when the --print-recs switch is given. rwaddrcount includes facilities for displaying only those IP address whose byte-, packet- or flow-counts are between specified minima and maxima. rwaddrcount does not support IPv6 addresses. To generate output for IPv6 records, use the rwuniq(1) tool: rwuniq --fields=sip --values=bytes,packets,records,stime,etime rwaddrcount 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, rwaddrcount 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. 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. For the application to operate, one of the three --print options must be chosen.
When a timezone is specified, it is used regardless of the default timezone support compiled into SiLK. The timezone is one of:
The following arguments modify certain IP addresses prior to printing. These arguments may be combined with the above formats. The following argument is also available:
Deprecated SwitchesThe following switches are deprecated. They will be removed in SiLK 4.0.
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. To print a list of source IP addresses that appeared in exactly one TCP record during the first 12 hours of 2003-Sep-01, use: $ rwfilter --start-date=2003/09/01:00 --end-date=2003/09/01:11 \
--proto=6 --pass=stdout \
| rwaddrcount --max-records=1 --print-ips
In general, to print out record information, use rwaddrcount with --print-recs $ rwfilter --start-date=2003/01/17:00 --end-date=2003/01/17:23 \
--proto=6 --pass=stdout \
| rwaddrcount --print-rec --no-title | head -3
10.10.10.1| 65792| 147| 21| 2003/01/17T00:19:01| 2003/01/17T02:00:13|
10.10.10.2| 110744| 89| 7| 2003/01/17T01:21:42| 2003/01/17T01:39:21|
10.10.10.3| 864| 18| 6| 2003/01/17T00:20:33| 2003/01/17T01:25:38|
Replacements for rwaddrcountWe note some overlapping features between rwaddrcount and rwuniq(1). There is often more than one way to perform the same task in the SiLK tool set. Here's a guide to replacing each of the outputs of rwaddrcount: The --print-recs switch prints five pieces of information for each source or destination address: $ rwaddrcount --print-recs data.rw
sIP|Bytes|Packets|Records| Start_Time| End_Time|
10.0.0.144| 1646| 4| 1|2007/05/09T18:01:41|2007/05/09T18:01:41|
10.14.203.121| 40| 1| 1|2007/05/09T18:31:54|2007/05/09T18:31:54|
10.14.203.122| 40| 1| 1|2007/05/09T18:32:43|2007/05/09T18:32:43|
10.15.6.14| 539| 3| 3|2007/05/09T18:03:05|2007/05/09T18:08:07|
12.0.101.22| 4365| 23| 2|2007/05/09T18:26:43|2007/05/09T18:43:46|
To do the same in rwuniq, specify either "sip" in --fields and the --values shown here: $ rwuniq --fields=sip --values=bytes,packets,flows,stime,etime data.rw
sIP|Bytes|Packets|Records| min_sTime| max_eTime|
10.0.0.144| 1646| 4| 1|2007/05/09T18:01:41|2007/05/09T18:01:41|
10.14.203.121| 40| 1| 1|2007/05/09T18:31:54|2007/05/09T18:31:54|
10.14.203.122| 40| 1| 1|2007/05/09T18:32:43|2007/05/09T18:32:43|
10.15.6.14| 539| 3| 3|2007/05/09T18:03:05|2007/05/09T18:08:07|
12.0.101.22| 4365| 23| 2|2007/05/09T18:26:43|2007/05/09T18:43:46|
When rwaddrcount includes --use-dest, change the --fields switch of rwuniq to "dip". Replace the --sort-ips switch of rwaddrcount with --sort-output in rwuniq. The --print-stat switch in rwaddrcount prints a one-line summary of the data: $ rwaddrcount --print-stat data.rw
| sIP_Uniq| Bytes| Packets| Records|
Total| 57727| 948620676| 2026581| 382578|
This is difficult to produce with rwuniq. If there is a field that you know is either empty or constant across all records (such as "nhip" or "in"), you can use that as the key field in rwuniq. $ rwuniq --fields=nhIP --values=distinct:sip,bytes,packets,flows data.rw
nhIP|sIP-Distinct| Bytes| Packets| Records|
0.0.0.0| 57727| 948620676| 2026581| 382578|
Note that "class" generally does not work since each type within a class produces its own row: $ rwuniq --fields=class --values=distinct:sip,bytes,packets,flows data.rw class|sIP-Distinct| Bytes| Packets| Records| all| 8674| 260143344| 964621| 151447| all| 55540| 688477332| 1061960| 6184399| One trick is to use "stime" as the key with a very large --bin-time: $ rwuniq --fields=stime --bin-time=2147483647 \
--values=distinct:sip,bytes,packets,flows data.rw
sTime|sIP-Distinct| Bytes| Packets| Records|
1970/01/01T00:00:00| 57727| 948620676| 2026581| 382578|
Finally, you can use separate invocations of rwfilter(1), rwset(1), and rwsetcat(1): $ rwfilter --print-volume --all=stdout data.rw \
| rwset --sip=stdout \
| rwsetcat --count-ips
| Recs| Packets| Bytes| Files|
Total| 382578| 2026581| 948620676| 1|
Pass| 382578| 2026581| 948620676| |
Fail| 0| 0| 0| |
57727
rwaddrcount's --print-ips switch prints the IP addresses as text: $ rwaddrcount --print-ips data.rw
sIP
10.0.0.144
10.14.203.121
10.14.203.122
10.15.6.14
12.0.101.22
A combination of rwset and rwsetcat is the best way to handle this: $ rwset --sip-file=stdout data.rw | rwsetcat --print-ips 10.0.0.144 10.14.203.121 10.14.203.122 10.15.6.14 12.0.101.22 Alternatively, use rwuniq and the UNIX tool cut(1) to only print the first column: $ rwuniq --fields=sIP data.rw \
| cut -d '|' -f 1
sIP
10.0.0.144
10.14.203.121
10.14.203.122
10.15.6.14
12.0.101.22
rwaddrcount allows you to restrict the output to bins that have a certain minimum or maximum count of bytes, packets, or flows via --min-bytes, --max-bytes, --min-packets, --max-packets, --min-records, and --max-records: $ rwaddrcount --print-recs --min-byte=1024 --max-byte=2048 \
--max-records=1 data.rw
sIP|Bytes|Packets|Records| Start_Time| End_Time|
10.0.0.144| 1646| 4| 1|2007/05/09T18:01:41|2007/05/09T18:01:41|
10.14.203.121| 40| 1| 1|2007/05/09T18:31:54|2007/05/09T18:31:54|
10.14.203.122| 40| 1| 1|2007/05/09T18:32:43|2007/05/09T18:32:43|
rwuniq supports the same operations using the --bytes, --packets, and --flows switches, each of which allows you to define a desired minimum and maximum value. $ rwuniq --fields=sip --values=bytes,packets,records,stime,etime \
--bytes=1024-2048 --flows=1-1 data.rw
sIP|Bytes|Packets|Records| min_sTime| max_eTime|
10.0.0.144| 1646| 4| 1|2007/05/09T18:01:41|2007/05/09T18:01:41|
10.14.203.121| 40| 1| 1|2007/05/09T18:31:54|2007/05/09T18:31:54|
10.14.203.122| 40| 1| 1|2007/05/09T18:32:43|2007/05/09T18:32:43|
ENVIRONMENT
FILES
SEE ALSOrwset(1), rwsetcat(1), rwstats(1), rwtotal(1), rwuniq(1), silk(7), tzset(3), environ(7) NOTESrwaddrcount only supports IPv4 addresses, and it will not be modified to support IPv6 addresses. To produce output similar to rwaddrcount for IPv6 addresses, use rwuniq(1): rwuniq --fields=sip --values=bytes,packets,records,stime,etime When used in an IPv6 environment, rwaddrcount 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 ignored. rwaddrcount uses a fairly large hashtable to store data, but it is likely that as the amount of data expands, the application will take more time to process data. Similar binning of records are produced by rwstats(1), rwtotal(1), and rwuniq(1). To generate a list of IP addresses without the volume information, use rwset(1).
|