Configure Enrichment¶
Optional Step
Mapping interfaces to their names can help in being able to quickly identify them in Splunk (i.e. vmx0
-> LAN
). This step can be skipped if enrichment is not required.
The steps to setup enrichment for this add-on utilize Splunk Lookups. For more information on lookups see Splunk Docs: About lookups.
Steps to configure enrichment:
Tip
To get a full list of interfaces being used in OPNsense:
From the OPNsense UI, navigate to Interfaces > Assignments.
Create a CSV Lookup¶
Method 1 - Use the Lookup Editor¶
Recommended
The lookup editor may be the easiest way to create and mange lookups in Splunk. You can download and install the Lookup Editor from Splunkbase: Lookup Editor.
Once installed, the lookup editor can be used to create a new CSV lookup.
- Open the Lookup Editor in Splunk Web.
- Click "Create a New Lookup" > CSV lookup.
- Give the lookup a descriptive name (i.e. opn_interfaces.csv).
- Choose which App context this lookup will be stored in (i.e. Search & Reporting).
- Leave the "User-only" box uncheked. This will give the lookup the global scope permissions it needs.
- Create column headers (row 1). These headers will be referenced later.
-
Populate the remaing rows with the interface name mappings.
Example
host interface interface_name opnsense-01 em0 LAN opnsense-01 em1 WAN opnsense-01 vmx1 IOT opnsense-01 wg0 WIREGUARD opnsense-02 vmx1 LAN opnsense-02 vmx2 WAN -
After saving, move to Create a Lookup Definition.
Method 2 - Create and Upload a new CSV file¶
A lookup file can be created outside of Splunk and then uploaded via the web interface.
- Use an editor to create a file in CSV format.
- Create column headers (row 1). These headers will be referenced later.
-
Populate the remaing rows with the interface name mappings.
-
Be sure to save the file with a
.csv
extension. - Open Splunk Web.
- Navigate to Settings > Lookups > Lookup table files (click "+ Add new")
- Select the Destination App (i.e. Search & Reporting).
- Upload the file.
- Provide the Destination filename. This can be the same name as the one created (i.e. opn_interfaces.csv).
- Once saved, Navigate back to Settings > Lookups > Lookup table files, if you are not already there.
- Search for the name of the file you just uploaded.
- Modify the permissions for the file by clicking "Permissions."
- Select "All apps (system)" from the two radio options.
- Check "Read" permissions for Everyone. Write permissions can be given as needed (typically set to admin & power).
- After saving, move to Create a Lookup Definition.
Create a Lookup Definition¶
After the CSV lookup has been created, a lookup definition needs to be created.
- In Splunk Web, Navigate to Settings > Lookups > Lookup definitions (click "+ Add new").
- Choose a destination app, or leave as default.
- Give the lookup a name (i.e. opn_interfaces)
- Select the previously created CSV lookup from the dropdown.
- Click the "Advanced" checkbox.
- Click the "Case Sensitive Match" checkbox to disable case sensitive matching.
- Once saved, Navigate back to Settings > Lookups > Lookup definitions.
- Search for the name of the lookup definition you just created.
- Modify the permissions for the file by clicking "Permissions."
- Select "All apps (system)" from the two radio options.
- Check "Read" permissions for Everyone. Write permissions can be given as needed (typically set to admin & power).
- After saving, move on to Create Automatic Lookup
Create an Automatic Lookup¶
After the Lookup definition has been created, an automatic lookup has to be configured for automatic enrichment.
- In Splunk Web, Navigate to Settings > Lookups > Automatic lookups (click "+ Add new").
- Choose a destination app, or leave as default.
- Give the lookup a name (i.e. opn_interfaces_auto_lookup)
- Select the previously created lookup definition from the dropdown.
- For the "Apply to" field, select sourcetype and type
opnsense:filterlog
. -
For the input fields, first specify the interface field from the created lookup. Then type
dest_int
for the second field. -
For the next input field, set
host
equal to a blank field. There is no need to rename this field.Example
host
= -
For the output fields, first specify the interface name field from the created lookup. Then type
dest_int_name
for the second field.- Once saved, Navigate back to Settings > Lookups > Automatic lookups.
- Search for the name of the automatic lookup you just created.
- Modify the permissions for the file by clicking "Permissions."
- Select "All apps (system)" from the two radio options.
- Check "Read" permissions for Everyone. Write permissions can be given as needed (typically set to admin & power).
- Click Save.