Skip to content
SPL // Splunk

Using the mvappend and mvjoin Command

KGI Avatar
 

Written by: Robert Caldwell | Last Updated:

 
June 4, 2025
 
Search Command Of The Week: mvappend and mvjoin
 
 

Originally Published:

 
June 2, 2025

Splunk Search Processing Language (SPL) enables organizations to extract actionable insights from complex machine-generated data streams. This includes commands like mvappend and mvjoin, which stand as fundamental tools for multi-value field manipulation. Effective management of these fields becomes essential for comprehensive data analysis. These commands provide the necessary functionality to combine and format multi-value data efficiently. 

Understanding the Commands

mvappend

The mvappend command creates multi-value fields by combining individual values or existing multi-value fields. This command creates a new field where these values are appended together in a new multi-value field. With this, analysts can consolidate related data points for better aid visualization and reporting. 

mvjoin

In contrast, the mvjoin command converts multi-value fields into single-value strings using specified delimiters. Analysts can format multi-value data for reporting, visualization, or export purposes. This command enables better integration with external systems that require delimited string formats. 

Both commands integrate naturally with Splunk’s field processing capabilities. They enhance data transformation workflows while maintaining processing efficiency. 

Benefits of Using mvappend and mvjoin

  • Enhanced Data Aggregation: These commands facilitate the consolidation of related information from multiple sources into unified multi-value structures. Security analysts can correlate threat indicators more effectively across disparate log sources and data feeds. 
  • Flexible Output Formatting: The ability to join multi-value fields with custom delimiters enables seamless integration with reporting tools and external systems. This flexibility supports various export requirements and visualization needs across different platforms. 
  • Streamlined Data Processing: By combining field creation and formatting operations, these commands reduce the complexity of multi-step data transformation pipelines. Analysts can achieve desired results with fewer search operations and improved performance. 

Proper Basic Syntax

mvappend Syntax

The fundamental syntax for mvappend follows this structure: 

				
					| eval new_field=mvappend(<field-or-value>[, <field-or-value>]) 
				
			
mvjoin Syntax

Meanwhile, the mvjoin command uses this pattern: 

 
				
					| eval joined_field=mvjoin(<multi_value_field>, "<delimiter>") 
				
			

Additionally, both commands can be combined within the same search to create comprehensive data transformation workflows. Next, we’ll cover examples and use cases of these commands. Think about the different ways we can manipulate these multi-values. 

Example Use Cases

Example #1: Normalize Error Codes
Use Case: A system administrator has errors brought into Splunk from various web servers. These web servers generate different log formats. Some even generate more than one error code in a multi-value field. She wants to have all of them report in the same field. 
				
					index=web 
| eval "Error Codes"= mvappend('error_code', 'error', 'code_number') 
				
			

Explanation: This search will take the various error code values and put them together under one banner. Each value is still considered a multi-value; this allows us to use other multi-value commands to transform and correlate these errors to logs on other systems that otherwise would be isolated. 

Example #2: Custom Reporting

Use Case: In the network index, there is a field called src which has a value of an IP address and a port. A networking team wants to make reporting easier by combining these two values. 

				
					index=network | eval src=mvjoin(src, ":") 
				
			
Explanation: This will transform the field from two values of “192.83.47.211” and “800” to “192.83.47.211:800”. This will aid in conveying the source of a network connection in a variety of contexts whether that be security, observability, monitoring, etc. 
Example #3: Asset Management Reporting

Use Case: IT operations teams require an IT inventory asset list consolidated from various inventory sources. This example demonstrates how to combine asset identifiers for reporting purposes using both mvappend and mvjoin. 

				
					index=assets sourcetype=inventory 
| eval asset_identifiers=mvappend(hostname, serial_number, asset_tag, mac_address) 
| eval asset_summary=mvjoin(asset_identifiers, " | ") 
| stats latest(asset_summary) as consolidated_info by department 
| sort department 
				
			
Explanation: This search creates unified asset records by combining multiple identification fields. It formats the output using pipe delimiters for clear presentation in management reports. We then use a stats command, getting a report with the most recent data. 

Conclusion

The mvappend and mvjoin commands provide essential capabilities for data consolidation and formatting operations. These tools enable users to with more flexitbilty in complex datasets to get the outputs they want. When combined, they can help in getting the most out of your multi-value fields. 

In summary: 

  • mvappend: You add to or create a new field with a series of values. These values can be strings, single-value fields, multi-value fields, or a mixture of the three. This operation maintains all of them as multi-value, allowing further transformation as such.
  • mvjoin: Combines all the values of a multi-value field into one string separated by a delimiter of your choice. This makes them into a single-value which can then be used in other transformations or for easier reporting. 
  • When used together, these commands streamline multi-value data processing tasks. They offer a high level of modification to your multi-value data without noticeable reduction in performance. This ensures you get the most out of your data. 

To access more Splunk searches, check out Atlas Search Library, which is part of the Atlas Platform. Specifically, Atlas Search Library offers a curated list of optimized searches. These searches empower Splunk users without requiring SPL knowledge. Furthermore, you can create, customize, and maintain your own search library. By doing so, you ensure your users get the most from using Splunk.

Helpful? Don't forget to share this post!
LinkedIn
Reddit
Email
Facebook