Extract a field from an existing field automatically:
You can use a field transform to automatically extract a new field from an existing auto-extracted field (this lets you choose a source key to extract from).
In the GUI, go to Settings --> Fields, then Field Transformations. Click New, then fill in the fields and click Save. The transformation will work automatically for all new searches in the relevant app context.
Extract a field from the raw data automatically:
If you need to automatically extract a new field from _raw in the first place, we would recommend using automatic extractions. Note that this will work on _raw, so your regex will be a little different - it will have to match on data from the whole event, so you might need something closer to FieldToExtractFrom:(?<ExtractedField>\d+) as your regex (using your example).
You can access this from the GUI by going to Settings --> Fields, then Field Extractions. Click New, then fill in the fields and click Save. The extraction will work automatically for all new searches in the relevant app context.
Extract data inline from a field with rex:
For once off extractions, you can use rex inline, like so:
| rex field=FieldToExtractFrom "(?<new_field_name>regexhere)"
As an example, say you wanted to extract the first name from a name field, where you have name="First Last" , you could use:
| rex field=name "^(?<first_name>\w+?)\s"
Which would extract the first name and put it in a new field called first_name .
If you have an example to post then I might be able to give a more specific answer for your use case, but I hope this helps.
... View more