Configure multivalue fields
This documentation does not apply to the most recent version of Splunk. Click here for the latest version.
Configure multivalue fields
Multivalue fields are fields that can appear multiple times in an event and have a different value for each appearance. One of the more common examples of multivalue fields is that of email address fields, which typically appears two to three times in a single sendmail event--once for the sender, another time for the list of recipients, and possibly a third time for the list of Cc addresses, if one exists. If all of these fields are labeled identically (as "AddressList," for example), they lose meaning that they might otherwise have if they're identified separately as "From", "To", and "Cc".
Splunk parses multivalue fields at search time, and enables you to process the values in the search pipeline. Search commands that work with multivalue fields include makemv, mvcombine, mvexpand, and nomv. For more information on these and other commands see the topic on multivalue fields in the User manual, and the Search Reference manual.
Use the TOKENIZER key to configure multivalue fields in fields.conf. TOKENIZER uses a regular expression to tell Splunk how to recognize and extract multiple field values for a recurring field in an event. Edit fields.conf in $SPLUNK_HOME/etc/system/local/, or your own custom application directory in $SPLUNK_HOME/etc/apps/.
For more information on configuration files in general, see "About configuration files" in the Admin manual.
For a primer on regular expression syntax and usage, see Regular-Expressions.info. You can test regexes by using them in searches with the rex search command. Splunk also maintains a list of useful third-party tools for writing and testing regular expressions.
Configure a multivalue field via fields.conf
Define a multivalue field by adding a stanza for it in fields.conf. Then add a line with the TOKENIZER key and a corresponding regular expression that shows how the field can have multiple values.
Note: If you have other attributes to set for a multivalue field, set them in the same stanza underneath the TOKENIZER line. See the fields.conf topic in the Admin manual for more information.
[<field name 1>] TOKENIZER = <regular expression> [<field name 2>] TOKENIZER = <regular expression>
-
<regular expression>should indicate how the field in question can take on multiple values. -
TOKENIZERdefaults to empty. WhenTOKENIZERis empty, the field can only take on a single value. - Otherwise the first group is taken from each match to form the set of field values.
- The
TOKENIZERkey is used by the where, timeline, and stats commands. It also provides the summary and XML outputs of the asynchronous search API.
Note: Tokenization of indexed fields (fields extracted at index time) is not supported. If you have set INDEXED=true for a field, you cannot also use the TOKENIZER key for that field. You can use a search-time extraction defined in props.conf and transforms.conf to break an indexed field into multiple values.
Example
The following examples from $SPLUNK_HOME/etc/system/README/fields.conf.example break email fields To, From, and CC into multiple values.
[To] TOKENIZER = (\w[\w\.\-]*@[\w\.\-]*\w) [From] TOKENIZER = (\w[\w\.\-]*@[\w\.\-]*\w) [Cc] TOKENIZER = (\w[\w\.\-]*@[\w\.\-]*\w)
This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 , 4.2 , 4.2.1 , 4.2.2 , 4.2.3 , 4.2.4 , 4.2.5 , 4.3 , 4.3.1 , 4.3.2 , 4.3.3 , 4.3.4 , 4.3.5 , 4.3.6 View the Article History for its revisions.