Custom Lookup Tables
Enrich events with your own stored data
Last updated
Was this helpful?
Enrich events with your own stored data
Last updated
Was this helpful?
Custom Lookup Tables (also referred to as simply "Lookup Tables") allow you to store and reference custom enrichment data in Panther. This means you can reference this added context in detections and alerts. It may be particularly useful to create Lookup Tables containing identity/asset information, vulnerability context, or network maps.
You can associate one or more log types with your Lookup Table, and then all logs of those types will contain enrichment data from your Lookup Table. See an .
Note that there are also , including Enrichment Providers like GreyNoise and IPinfo, as well as Identity Provider Profiles. Consider using instead when extra information is only needed for a few specific detections and will not be frequently updated.
To increase the limit on the number of Lookup Tables or the size of Lookup Tables in your account, please contact your Panther support team.
One or more Lookup Table name(s) that matched the incoming log event
The name of the selector from the incoming log that matched the Lookup Table
The data from the Lookup Table that matched via the Lookup Table's primary key (including an injected p_match
field containing the selector value that matched)
This is the structure of p_enrichment
fields:
When configuring a Lookup Table, you will define the following:
Selector(s): one or more fields within the log type(s) the Lookup Table is associated to
When Panther parses one of the associated logs, it compares the value of the selector(s) in the event with the values of the primary key in the Lookup Table. If a match is found, Panther adds the corresponding row from the Lookup Table to the log event's p_enrichment
struct, and injects a p_match
field containing the value that matched.
A schema specifically for your Lookup Table data.
This describes the shape of your Lookup Table data.
Selector(s) from your incoming logs.
The values from these selectors will be used to search for matches in your Lookup Table data.
A primary key for your Lookup Table data.
This primary key is one of the fields you defined in your Lookup Table's schema. The value of the primary key is what will be compared with the value of the selector(s) from your incoming logs.
For local development and CI/CD: ensure you have the necessary configuration files in your environment.
Your Lookup Table's primary key column must have one of the following data types:
String
Number
Array (of strings or numbers)
Using an array lets you associate one row in your Lookup Table with multiple string or number primary key values. This prevents you from having to duplicate a certain row of data for multiple primary keys.
Perhaps you'd like to store user data in a Lookup Table so that incoming log events associated with a certain user are enriched with additional personal information. You'd like to match on the user's email address, which means the email field will be the primary key in the Lookup Table and the selector in the log events.
You are deciding whether the primary key column in your Lookup Table should be of type string or string array. First, review the below two events you might expect to receive from your log source:
Note that the two email addresses (janedoeemailone@mail.com
and janedoeemailtwo@mail.com
) belong to the same user, Jane Doe
.
When Panther receives these events, you would like to use a Lookup Table to enrich each of them with Jane's full name and role. After enrichment, these events would look like the following:
You can accomplish this enrichment by defining a Lookup Table with either:
(Recommended) A primary key column that is of type array of strings
A primary key column that is of type string
Using a Lookup Table with a primary key column that is of type array of strings, you can include Jane's multiple email addresses in one primary key entry, associated to one row of data. This might look like the following:
["janedoeemailone@mail.com", "janedoeemailtwo@mail.com"]
"Jane Doe"
"ADMIN"
Alternatively, you can define a Lookup Table with a primary key column that is of type string. However, because the match between the event and Lookup Table is made on the user's email address, and a user can have multiple email addresses (as is shown in Jane's case), you must duplicate the Lookup Table row for each email. This would look like the following:
"janedoeemailone@mail.com"
"Jane Doe"
"ADMIN"
"janedoeemailtwo@mail.com"
"Jane Doe"
"ADMIN"
While both options yield the same result (i.e., incoming log events are enriched in the same way), defining a Lookup Table with an array of strings primary key is recommended for its convenience and reduced proneness to maintenance error.
The maximum size for a row in a Lookup Table is 65535 bytes.
This option is best for data that is relatively static, such as information about AWS accounts or corporate subnets. You may want to set up a Lookup Table via a File Upload in the Panther Console. For example, a possible use case is adding metadata to distinguish developer accounts from production accounts in your AWS CloudTrail logs.
You can import via file upload through the Panther Console or with PAT:
In some cases, you may want to sync from an S3 source to set up a Lookup Table. For example, if you want to know what groups and permission levels are associated with the employees at your company. In this scenario, your company might have an AWS S3 source with an up-to-date copy of their Active Directory listing that includes groups and permissions information.
This option is best for a larger amount of data that updates more frequently from an S3 bucket. Any changes in the S3 bucket will sync to Panther.
You can sync via S3 through the Panther Console or with PAT:
After you configure a Lookup Table, you can write detections based on the additional context from your Lookup Table.
For example, if you configured a Lookup Table to distinguish between developer and production accounts in AWS CloudTrail logs, you might want receive an alert only if the following circumstances are both true:
A user logged in who did not have MFA enabled.
The AWS account is a production (not a developer) account.
See how to create a detection using Lookup Table data below:
The rule would become:
The Panther rules engine will take the looked up matches and append that data to the event using the key p_enrichment
in the following JSON structure:
Example:
If the value of the matching log key is an array (e.g., the value of p_any_aws_accout_ids
), then the lookup data is an array containing the matching records.
Example:
For rules that use p_enrichment
, click Enrich Test Data in the upper right side of the JSON code editor to populate it with your Lookup Table data. This allows you to test a Python function with an event that contains p_enrichment.
Lookup Tables will generate a number of tables in the Data Explorer. There are 2 main types of tables generated:
The current Lookup Table version: example
Contains the most up to date Lookup Table data
Should be targeted in any saved queries - or anywhere you expect to see the most current data
This table name will never change
In the example above, the table is named example
The current History Table version: example_history
Contains a version history of all data uploaded to the current Lookup Table
The table schema is identical to the current Lookup Table (here named example
) except for 2 additional fields:
p_valid_start
p_valid_end
These fields can be used to view the state of the lookup table at any previous point in time
When a new schema is assigned to the Lookup Table, the past versions of the Lookup Table and the History Table are both preserved as well.
These past versions are preserved by the addition of a numeric suffix, _###
and will be present for both the Lookup Table and the History Table. This number will increment by 1 each time the Schema associated with the Lookup Table is replaced, or each time the primary key of the Lookup Table changed.
Your are associated with one or more log types, connected by foreign key fields called Selectors. Data enrichment begins prior to log events received by the detections engine, thus every incoming log event with a match in your Lookup Table will be enriched. If a match is found, a p_enrichment
field is appended to the event and accessed within a detection using deep_get()
or DeepKey
. The p_enrichment
field will contain:
: a column in the Lookup Table
See the below section to learn more about primary key requirements.
We recommend you make a fork of the panther-analysis repo to install the .
After fulfilling the , Lookup tables can be created and configured using either of the following methods:
After choosing one of these methods, you can opt to work within the Panther Console or with the .
In the upper right side of the page, click Create New to add a new Lookup Table.
Next to Enabled? toggle the setting to Yes. Note: This is required to import your data later in this process.
You also can reference attributes in nested objects using . For example, if you wanted to reference a field in a map you could do $.field.subfield
.
Click Add Log Type to add another if needed.
In the example screen shot above, we selected AWS.CloudTrail logs and typed in accountID
and recipientAccountID
to represent keys in the CloudTrail logs.
Configure the Table Schema. Note: If you have not already created a new schema, please see . You can also use your Lookup Table data to infer a schema. Once you have created a schema, you will be able to choose it from the dropdown on the Table Schema page while configuring a Lookup Table. Note: CSV schemas require column headers to work with Lookup Tables.
Select a Primary Key Name from the dropdown. This should be a unique column on the table, such as accountID
.
Drag and drop a file or click Select File to choose the file of your Lookup Table data to import. The file must be in .csv
or .jsonl
format.
The alert destinations for this alarm are displayed at the bottom of the page. To configure and customize where your notification is sent, see documentation on .
​ ​
All files related to your Lookup Tables must be stored in a folder with a name containing lookup_tables
. This could be a top-level lookup_tables
directory, or sub-directories with names matching *lookup_tables*
. You can use the repo as a reference.
Create a YAML file for the schema, and save it with the rest of your custom schemas, outside the lookup_tables
directory (for example, /schemas
in the root of your panther analysis repo). This schema defines how to read the files you'll use to upload data to the table. If using a CSV file for data, then the schema should be able to parse CSV.
The table schema is formatted the same as a log schema. For more information on writing schemas, read our documentation around
In the upper right side of the page, click Create New to add a new Lookup Table.
Click Add Log Type to add another if needed.
In the example screen shot above, we selected AWS.VPCFlow logs and typed in account
to represent keys in the VPC Flow logs.
Configure the Table Schema. Note: If you have not already created a new schema, please see . Once you have created a schema, you will be able to select it from the dropdown on the Table Schema page while configuring a Lookup Table.
On the "Choose Import Method" page, click Set Up next to "Sync Data from an S3 Bucket."
Enter the Update Period, the cadence your S3 source gets updated (defaulted to 1 hour).
Please see the next section, , for instructions on the three options available to do this.
The alert destinations for this alarm are displayed at the bottom of the page. To configure and customize where your notification is sent, see documentation on .
​​
.
.
Click Launch Console UI.
All files related to your Lookup Tables must be stored in a folder with a name containing lookup_tables
. This could be a top-level lookup_tables
directory, or sub-directories with names matching *lookup_tables*
. You can use the repo as a reference.
Create a YAML file for the schema, and save it in the lookup table directory (for example, lookup_tables/my_table/my_table_schema.yml
). This schema defines how to read the files you'll use to upload data to the table. If using a CSV file for data, then the schema should be able to parse CSV.
The table schema is formatted the same as a log schema. For more information on writing schemas, read our documentation around
The ARN of an IAM role in AWS, which Panther can use to access the S3 bucket. For more information on setting up an IAM role for Panther, see the section on
In Python, you can use the to retrieve the looked up field from p_enrichment
using the foreign key field in the log. The pattern looks like this:
In YAML, you can create an .
Click ... in the upper right corner of the Lookup Table you wish to view, then click View In Data Explorer.
For more information on using Data Explorer, please see the documentation: .