In Splunk, a multivalued field is a field that contains more than one value in a single event.
Instead of:
email = [email protected]
You might have:
email = [email protected]; [email protected]; [email protected]
Splunk can treat this as a single string or, using multivalue functions, split it into separate values.
Multivalued fields are displayed with values separated by spaces or semicolon/commas, depending on their format.
Splunk provides several specialized commands to handle multivalued fields. These allow you to split, count, filter, and expand values as needed.
makemvThe makemv command converts a delimited string into a multivalue field.
Syntax:
eval <new_field> = makemv(delim="<separator>", <original_field>)
Example:
eval email_list = makemv(delim=";", email)
This transforms:
email = [email protected];[email protected];[email protected]
Into a true multivalued field:
email_list = [[email protected], [email protected], [email protected]]
mvexpandmvexpand takes a multivalue field and creates one event per value.
Example:
... | mvexpand email_list
If one event had three email addresses, Splunk will now produce three events, each with one email from that list. This is helpful when:
You want to treat each value as an individual record
You need to join/enrich each value separately
mvcount, mvindex, mvfilterThese functions are used to inspect and manipulate multivalued fields.
| Function | Purpose | Example |
|---|---|---|
mvcount() |
Returns the number of values in a field | mvcount(user_list) |
mvindex() |
Retrieves a specific value by index (0-based) | mvindex(user_list, 1) → second value |
mvfilter() |
Filters values based on a condition | mvfilter(match(email, ".*@gmail.com")) |
Let’s look at common use cases and how to apply multivalue functions effectively.
If you want to retrieve the second user from a multivalued field user_list:
eval second_user = mvindex(user_list, 1)
This is useful when:
You expect a fixed number of users
You want to extract a specific role (e.g., second role in a list)
To find events where the user_list field has more than one user:
where mvcount(user_list) > 1
This helps identify shared access, group activity, or bulk operations.
eval recipients = makemv(delim=",", to_field)
| mvexpand recipients
This:
Converts a comma-separated to_field into a multivalue list
Creates one event per recipient
Useful when analyzing email logs, alert notifications, or batch processes.
| Command / Function | Purpose |
|---|---|
makemv |
Split a delimited string into a multivalue field |
mvexpand |
Breaks a multivalue field into multiple events |
mvcount() |
Returns number of values in a multivalue field |
mvindex() |
Returns value at a specific index in a multivalue field |
mvfilter() |
Filters multivalue entries by condition |
| Scenario | Recommended Command |
|---|---|
| Splitting tags in logs | makemv |
| Analyzing one tag per row | mvexpand |
| Checking how many users accessed a resource | mvcount(user_list) |
| Extracting the first or last IP from a list | mvindex(ip_list, 0) |
| Filtering emails by domain | mvfilter(match(email, ".*@company.com")) |
split() vs makemv() – What’s the Difference?Both split() and makemv are used to create multivalued fields, but they operate differently and often confuse beginners.
split()A function used inside eval.
Converts a string into a list (multivalue field) based on a delimiter.
| eval user_list=split(users, ",")
Result:
A multivalue field user_list containing values from the comma-separated string.
makemvA command, not a function.
Operates on existing fields (typically _raw or structured fields).
Can also use custom delimiters.
| makemv delim=";" user_field
Key Differences:
| Aspect | split() |
makemv |
|---|---|---|
| Type | Function (used in eval) |
Command |
| Input | A string | A field |
| Output | Multivalue list | Multivalue field |
| Use case | When transforming a string inline | When splitting existing field values |
mvcombine – Combine Values into a Multivalued FieldThe mvcombine command does the opposite of what mvexpand does. It groups rows by a field and combines values from another field into a multivalue list.
... | stats count by user, role
| mvcombine role by user
Effect:
You collapse multiple rows per user (each with a unique role) into a single row per user, with role as a multivalued field.
Use case:
Useful when you want to aggregate multiple roles, tags, or permissions associated with a single entity.
statsWhen using aggregation commands like stats, multivalued fields can be created using functions like values() or list().
... | stats values(tag) as tag_list by event_id
values(tag) aggregates unique values of the field tag per event_id.
The result tag_list becomes a multivalue field.
This allows further operations such as:
| eval first_tag=mvindex(tag_list, 0)
or
| where mvcount(tag_list) > 3
| Tool | Type | Purpose |
|---|---|---|
split() |
Function | Convert a delimited string into a multivalue list |
makemv |
Command | Split field into multiple values using a delimiter |
mvcombine |
Command | Merge multiple rows into one with multivalue field |
stats values() |
Command | Create multivalue fields per group |
mvindex() |
Function | Access specific value from a multivalue field |
mvcount() |
Function | Count number of values in a multivalue field |
When should you use makemv?
Use makemv when a single field contains delimited values that should become a true multivalue field.
It converts a flat string representation into a structure that other multivalue commands and functions can handle correctly. This is often the first step before mvexpand, multivalue eval functions, or lookup workflows. The exam usually tests whether you recognize the need to convert format before processing. If the field is still one comma-separated string, most multivalue operations will not behave as intended until makemv is applied.
Demand Score: 71
Exam Relevance Score: 90
What is the main tradeoff when using mvexpand?
It makes analysis simpler by turning each value into its own row, but it can greatly increase result volume.
That tradeoff is why users often complain that the output becomes duplicated or too large. mvexpand is powerful for normalization and downstream stats, but it should be used deliberately and as late as practical. On the exam, if the requirement is “one row per multivalue element,” mvexpand is typically right. If the requirement is just to count or compare values without full expansion, multivalue eval functions may be better.
Demand Score: 76
Exam Relevance Score: 92
Why are multivalue eval functions important even when mvexpand exists?
Because they let you transform, compare, or inspect multivalue fields without exploding the event count.
This is often more efficient and keeps event context intact. Users frequently overuse mvexpand when they really need a targeted comparison, filtering step, or derived value from the multivalue field. The exam angle is choosing the least disruptive tool for the requirement. If the scenario only needs to compare sets or derive one summary field, multivalue eval functions are often the better answer.
Demand Score: 70
Exam Relevance Score: 88
Why can multivalued fields complicate lookup enrichment?
Because many lookup patterns assume one key value per row, while multivalued fields may need preprocessing or expansion.
If a lookup is run directly against a multivalue field, only part of the data may match as expected. That is why users often convert, expand, or otherwise reshape the field before enrichment. The exam tests whether you see the structural mismatch between a multivalue list and a row-based lookup design. If the requirement is “enrich each element,” some form of multivalue handling is usually needed first.
Demand Score: 69
Exam Relevance Score: 86