Similar to pointers in C, this allows you to dereference a field like a pointer to fetch a value from another field.
pointerset <target_field> pointer=<ptrField> ptrFieldFilter="srcField-1|srcField-2|srcPattern*" default=<default value>
target_field:
- The field to create and set
- Required
pointer:
- The field that contains the name of the field with the value we want to set target_field to.
- Required
- If the field doesn't exist on the event the default is used
ptrFieldFilter:
- This option can accept basic patterns for mattching with a *, no other wildcard characters are available.
- Multiple field/field patterns can be specified using pipes: "Field*|OtherPattern*|*_MySuffix"
- Optional, default value is * (all fields)
- Warning: Performance over large datasets almost requires you to specify the ptrFieldFilter option. This list should only contain field names that 'pointer' can point to.
default:
- Optional, default value is ""
| makeresults
| eval Field1=1
| eval Field2=2
| eval Field3=3
| eval Field4=4
| eval pointer_field="Field4"
| pointerset newField pointer="pointer_field"
Field1 | Field2 | Field3 | Field4 | pointer_field | newField |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | Field4 | 4 |
For larger datasets be sure to specify the ptrFieldFilter otherwise performance will be impacted:
| makeresults
| eval Field1=1
| eval Field2=2
| eval Field3=3
| eval Field4=4
| eval pointer_field="Field4"
| pointerset newField pointer="pointer_field" ptrFieldFilter="Field*"
Added appIcon
As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 10GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps from Splunk, our partners and our community. Find an app for most any data source and user need, or simply create your own with help from our developer portal.