![]() |
![]()
| ![]() |
![]()
NAMErwsiteinfo - Print information from the silk.conf site configuration file SYNOPSISrwsiteinfo --fields=FIELD[,FIELD...] { [--classes=CLASS[,CLASS...]] [--types=TYPE[,TYPE...]] | [--flowtypes=CLASS/TYPE[,CLASS/TYPE...]] } [--sensors=SENSOR[,SENSOR...]] [--groups=GROUP[,GROUP...]] [--data-rootdir=ROOT_DIRECTORY] [--site-config-file=FILENAME] [--timestamp-format=FORMAT] [--no-titles] [--no-columns] [--column-separator=CHAR] [--no-final-delimiter] [{--delimited | --delimited=CHAR}] [--list-delimiter=CHAR] [--output-path=PATH] [--pager=PAGER_PROG] rwsiteinfo --help rwsiteinfo --help-fields rwsiteinfo --version DESCRIPTIONrwsiteinfo is a utility to print selected information about the classes, types, flowtypes, sensors, and groups (collections of sensors) that are defined in the silk.conf(5) site configuration file. The --fields switch is required, and its argument is a comma-separated list of field names selecting the fields to be printed. The output from rwsiteinfo consists of multiple columns and rows, where each column contains one of the FIELDs and where each row has a unique value for one of the FIELDs. rwsiteinfo prints rows until all possible combinations of fields is exhausted. By default, the information is printed in a columnar, bar-delimited ("|"-delimited) format. As of SiLK 3.11.0, rwsiteinfo can visit the files in the data repository to report the date of the earliest (oldest) file in the repository, the date of the latest (most recent) file in the repository, and the number of files in the repository. These values are reported individually for each row in the output. Note: If your data repository is large, scanning it may take a long time. The --classes, --types, --flowtypes, --sensors, and --groups switches allow the user to limit the amount of information printed. (These switches operate similarly to their namesakes on rwfilter(1) and rwfglob(1).) If none of these switches are given, rwsiteinfo prints information for all values defined in the silk.conf file. If one or more of these switches is specified, rwsiteinfo limits its output to the specified values. The limit is applied even if that field is not listed in --fields. For example, specifying --sensors=S1 --fields=class tells rwsiteinfo to limit the output to classes that have sensor "S1" as a member. To print information about the default class or the default types within a class, use the at-sign ("@") as the name of the class or type, respectively. The --flowtypes switch must be used independently of the --classes and --types switches. SiLK 3.21.0 added support for sensor groups to rwsiteinfo. Sensor groups are defined in the silk.conf(5) file within a group block. The --sensors switch accepts sensor group names to limit the output to sensors defined with the named groups. The --groups switch may be used to limit the output to specified sensor groups. Using the same argument to --groups or --sensors produces the same result unless --fields includes group and the silk.conf file has sensors as members of multiple groups. As of SiLK 3.20, the --classes, --types, --flowtypes, --sensors, and --groups switches accept a value in the form @PATH, where PATH names a file (that is, an "@" character followed by a file or path name). The format of this file is described in the "Read Argument Values from a File" section below. As stated above, rwsiteinfo prints unique rows given a list of FIELDs. As an example, suppose the user entered the command "rwsiteinfo --fields=class,type,sensor". rwsiteinfo will print a row containing the first class defined in the silk.conf file, the first type defined for that class, and the first sensor name defined for that class/type pair. On the next row, the class and type will be the same and the second sensor name will be printed. Once all sensors have been printed, rwsiteinfo repeats the process for the second type defined for the first class, and so on. Once all information for the first class has been printed, the process would repeat for the next class, until all classes have been printed. The order of the FIELDs determines how rwsiteinfo iterates through the possible values. The last FIELD will change most rapidly, and the first field will change most slowly. Two invocations of rwsiteinfo where the first specifies "--fields=class,sensor" and the second specifies "--fields=sensor,class" produce the same number of rows, and each invocation has an outer and inner iterator. In the first invocation, the outer iterator is over the classes, and the inner iterator is over each sensor defined in that class. In the second invocation, the outer iterator is over the sensors, and the inner is over the classes to which that sensor belongs. In general, the output will contain some combination of class, type, flowtype, and sensor. For flowtype and sensor, the numeric ID may be printed instead of the name. For class and type, the default values may be printed or they may be identified by a symbol. Most field names support a FIELD:list variant that puts all possible values for that field into a single column. See the description of the --fields switch below for details. Read Argument Values from a FileAs of SiLK 3.20, the --classes, --types, --flowtypes, --sensors, and --group switches accept a value in the form @PATH, where "@" is the "at" character (ASCII 0x40) and PATH names a file or a path to a file. For example, the following reads the name of types from the file t.txt and uses the sensors "S3", "S7", and the names and/or IDs read from /tmp/sensor.txt: rwsiteinfo --type=@t.txt --sensors=S3,@/tmp/sensor.txt,S7 Multiple @PATH values are allowed within a single argument. If the name of the file is "-", the names are read from the standard input. The file must be a text file. Blank lines are ignored as are comments, which begin with the "#" character and continue to the end of the line. Whitespace at the beginning and end of a line is ignored as is whitespace that surrounds commas; all other whitespace within a line is significant. A file may contain a value on each line and/or multiple values on a line separated by commas and optional whitespace. For example: # Sensor 4 S4 # The first sensors S0, S1,S2 S3 # Sensor 3 An attempt to use an @PATH directive in a file is an error. When rwsiteinfo is parsing the name of a file, it converts the sequences "@," and "@@" to "," and "@", respectively. For example, --class=@cl@@ss.txt@,v reads the class from the file cl@ss.txt,v. It is an error if any other character follows an embedded "@" (--flowtypes=@f@il contains @i) or if a single "@" occurs at the end of the name (--sensor=@errat@). 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.
When a timezone is specified, it is used regardless of the default timezone support compiled into SiLK. The timezone is one of:
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. The output from these examples is based on the sample silk.conf as distributed for the twoway site (c.f. packlogic-twoway(3)). Displaying the sensors with various optionsThis displays all known sensors using the default display options: $ rwsiteinfo --fields=sensor Sensor| S0| S1| S2| S3| S4| S5| S6| S7| S8| S9| S10| S11| S12| S13| S14| The following prints all known sensor names, one name per line: $ rwsiteinfo --fields=sensor --no-titles --delimited S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 The following prints all known sensor names on a single line with the names separated by comma: $ rwsiteinfo --fields=sensor:list --no-titles --delimited S0,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14 This changes the output from the previous example to use a space as the separator: $ rwsiteinfo --fields=sensor:list --no-titles --delimited \ --list-delimiter=' ' S0 S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 The following prints the sensor names for the default class on a single line (since there is a single class, the output is the same as that shown above): $ rwsiteinfo --fields=sensor:list --class=@ --no-titles --delimited S0,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14 This shows the numeric sensor IDs: $ rwsiteinfo --fields=id-sensor:list Sensor-ID:list| 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14| The following prints four columns: (1) the sensor identifier, (2) the sensor name, (3) the list of classes for that sensor, and (4) a description of the sensor. This output mimics the output of the deprecated mapsid(1) tool. $ rwsiteinfo --fields=id-sensor,sensor,class:list,describe-sensor Sensor-ID|Sensor|Class:list| Sensor-Description| 0| S0| all| Description for sensor S0| 1| S1| all| | 2| S2| all|Optional description for sensor S2| 3| S3| all| | 4| S4| all| | 5| S5| all| | 6| S6| all| | 7| S7| all| | 8| S8| all| | 9| S9| all| | 10| S10| all| | 11| S11| all| | 12| S12| all| | 13| S13| all| | 14| S14| all| | Displaying classes and typesThis prints three columns: the first contains the class, the second contains the type, and the third uses a "+" to mark rows for the default class and a "*" to mark rows for a default type. $ rwsiteinfo --fields=class,type,mark-default Class| Type|Defaults| all| in| +*| all| out| + | all| inweb| +*| all| outweb| + | all| innull| + | all|outnull| + | all|int2int| + | all|ext2ext| + | all| inicmp| +*| all|outicmp| + | all| other| + | The following prints two columns, the first containing a class name and the second the list of default types for that class: $ rwsiteinfo --fields=class,default-type:list Class|Default-Type:list| all| in,inweb,inicmp| The following prints the default types. (The output contains the default type for each class, but twoway site has a single class.) $ rwsiteinfo --fields=default-type --no-titles --delimited in inweb inicmp This does the same (by limiting the output the default types). $ rwsiteinfo --fields=type --types=@ --no-titles --delimited in inweb inicmp The following prints the class, the sensor, and the type. The number of rows of output (excluding the title) is the product of the number of classes, number of types, and number of sensors. $ rwsiteinfo --fields=class,sensor,type Class|Sensor| Type| all| S0| in| all| S0| out| all| S0| inweb| all| S0| outweb| all| S0| innull| all| S0|outnull| all| S0|int2int| all| S0|ext2ext| all| S0| inicmp| all| S0|outicmp| all| S0| other| all| S1| in| all| S1| out| ... all| S14|outicmp| all| S14| other| Displaying sensor groupsThe --group switch was added in SiLK 3.21.0 and limits the output to particular sensor groups. In addition, the --sensors switch accepts sensor group names. Given this silk.conf file: sensor 1 S1 sensor 2 S2 sensor 3 S3 group G12 sensors S1 S2 end group group G13 sensors S1 S3 end group ... Using --group=G12 limits the output to that group: $ rwsiteinfo --fields=group,sensor --group=G12 Group|Sensor| G12| S1| G12| S2| If --sensors=G12 is used, rwsiteinfo limits the output to the sensors that group contains (S1 and S2). The result includes group G13 since that group contains sensor S1: $ rwsiteinfo --fields=group,sensor --sensor=G12 Group|Sensor| G12| S1| G12| S2| G13| S1| This occurs when sensors appear in multiple groups and group is one of the output --fields. Displaying information about the flow data repositoryThe repo-start-date, repo-end-date, and repo-file-count fields print the range of available dates for the files in the repository. The following shows information about files in the repository for the repository as a whole: $ rwsiteinfo --fields=repo-start-date,repo-end-date,repo-file-count Start-Date| End-Date|File-Count| 2009/02/12T00:00:00|2009/02/14T23:00:00| 2880| This breaks down the file information per type: $ rwsiteinfo --fields=type,repo-start-date,repo-end-date,repo-file-count Type| Start-Date| End-Date|File-Count| in|2009/02/12T00:00:00|2009/02/14T23:00:00| 720| out|2009/02/12T00:00:00|2009/02/14T23:00:00| 720| inweb|2009/02/12T00:00:00|2009/02/14T23:00:00| 720| outweb|2009/02/12T00:00:00|2009/02/14T23:00:00| 720| innull| | | 0| outnull| | | 0| int2int| | | 0| ext2ext| | | 0| inicmp| | | 0| outicmp| | | 0| other| | | 0| This shows the information for each sensor: $ rwsiteinfo --fields=type,repo-start-date,repo-end-date,repo-file-count Sensor| Start-Date| End-Date|File-Count| S0|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S1|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S2|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S3|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S4|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S5|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S6|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S7|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S8|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S9|2009/02/12T00:00:00|2009/02/14T23:00:00| 288| S10| | | 0| S11| | | 0| S12| | | 0| S13| | | 0| S14| | | 0| Restricting the output by reading names from a fileSuppose the file sensors.txt exits in the current directory and has the content shown here: $ cat sensors.txt # Sensor 4 S4 # The first sensors S0,S1,S2 S3 # Sensor 3 When using SiLK 3.20.0 or later, the file can be used to restrict which sensors rwsiteinfo displays: $ rwsiteinfo --fields=class,sensor --sensor=@/tmp/foobart Class|Sensor| all| S0| all| S1| all| S2| all| S3| all| S4| An example that shows use of the "@" escapes when parsing the name of a file (file weird,n@me becomes "weird@,n@@me"), and the error generated when attempting to use @PATH within a file: $ cat weird,n@me S1 @another-file $ rwsiteinfo --fields=sensor --sensor=@weird@,n@@me rwsiteinfo: Error parsing sensors '@weird@,n@@me': Bad token '@another-file' found in file 'weird,n@me': May not recursively use @FILE construct within a file ENVIRONMENT
FILES
NOTESrwsiteinfo added support for sensor groups in SiLK 3.21.0. For information on sensor groups, see the documentation for the group block command in the silk.conf(5) manual page. The ability to read classes, types, sensors, and flowtypes from files via the @PATH directive was added in SiLK 3.20.0. The --output-path switch was added in SiLK 3.15.0. The repo-start-date, repo-end-date, and repo-file-count fields were added in SiLK 3.11.0. rwsiteinfo was added in SiLK 3.0. rwsiteinfo duplicates the functionality found in mapsid(1). mapsid is deprecated, and it will be removed in the SiLK 4.0 release. Examples of using rwsiteinfo in place of mapsid are provided in the latter's manual page. SEE ALSOsilk.conf(5), mapsid(1), rwfilter(1), rwfglob(1), packlogic-twoway(3), silk(7), tzset(3), environ(7)
|