Creating Reference Data Collections by Using the Command Line
Use the command line to manage reference data collections that cannot be managed in JSA, such as reference maps, map of sets, map of maps, and tables. Although it's easier to manage reference sets using JSA, use the command line when you want to schedule management tasks.
Use the ReferenceDataUtil.sh
script to manage reference sets and other types of reference data collections.
When you use an external file to populate the reference data collection, the first non-comment line in the file identifies the column names in the reference data collection. Each line after that is a data record that gets added to the collection. While the data type for the reference collection values is specified when the collection is created, each key is an alphanumeric string.
The following table shows examples of how to format data in an external file that is to be used for populating reference maps.
Table 1: Formatting Data in an External File to Be Used for Populating Reference Data Collections
Type of reference collection | Data formatting examples |
---|---|
Reference map | |
Reference map of sets | |
Reference map of maps | |
You can also create reference data collections by using the /reference_data
endpoint in the JSA RESTful API.
- Using SSH, log in to JSA as the root user.
- Go to the
/opt/qradar/bin
directory. - To create the reference data collection, type the following
command:
./ReferenceDataUtil.sh create name [SET | MAP | MAPOFSETS | MAPOFMAPS | REFTABLE] [ALN | NUM | IP | PORT | ALNIC | DATE] [-timeoutType=[FIRST_SEEN | LAST_SEEN]] [-timeToLive=]
- To populate the map with data from an external file, type
the following command:
./ReferenceDataUtil.sh load name filename [-encoding=...] [-sdf=" ... "]
Here are some examples of how to use the command line to create different types of reference data collections:
Create an alphanumeric map:
./ReferenceDataUtil.sh create testALN MAP ALN
Create a map of sets that contains port values that will age out 3 hours after they were last seen:
./ReferenceDataUtil.sh create testPORT MAPOFSETS PORT -timeoutType=LAST_SEEN -timeToLive='3 hours'
Create a map of maps that contains numeric values that will age out 3 hours 15 minutes after they were first seen:
./ReferenceDataUtil.sh create testNUM MAPOFMAPS NUM -timeoutType=FIRST_SEEN -timeToLive='3 hours 15 minutes'
Create a reference table where the default format is alphanumeric:
./ReferenceDataUtil.sh create testTable REFTABLE ALN -keyType=ipKey:IP,portKey:PORT,numKey:NUM,dateKey:DATE
Log in to JSA to create rules that add data to your reference data collections. You can also create rule tests that detect activity from elements that are in your reference data collection.
Command Reference for Reference Data Utilities
You can manage your reference data collections by using the ReferenceDataUtil.sh
utility on the command line. The
following commands are available to use with the script.
Create
Creates a reference data collection.
ALN specifies alphanumeric values. This data type supports IPv4 and IPv6 addresses.
ALNIC specifies alphanumeric values, but rule tests ignore the case. This data type supports IPv4 and IPv6 addresses.
NUM specifies numeric values.
IP specifies IP addresses. This data type supports only IPv4 address.
PORT specifies port addresses.
DATE specifies date values.
Update
Updates a reference data collection.
Add
Adds a data element to a reference data collection.
MAP and MAPOFSETS require Key 1.
MAPOFMAPS and REFTABLE require Key 1, and the second-level Key 2.
Delete
Deletes an element from a reference data collection.
MAP and MAPOFSETS require Key 1.
MAPOFMAPS and REFTABLE require Key 1, and the second-level Key 2.
Remove
Removes a reference data collection.
Purge
Purges all elements from a reference data collection.
List
Lists elements in a reference data collection.
Listall
Lists all elements in all reference data collection.
Load
Populates a reference data collection with data from an external .csv file.