Evaluate and manipulate fields with multiple values (2024)

About multivalue fields

A multivalue field is a field that contains more than one value. For example, events such as email logs often have multivalue fields in the To: and Cc: information.

Multivalue fields are parsed at search time, which enables you to process the values in the search pipeline. Search commands that work with multivalue fields include makemv, mvcombine, mvexpand, and nomv. The eval and where commands support functions, such as mvcount(), mvfilter(), mvindex(), and mvjoin() that you can use with multivalue fields. See Evaluation functions in the Search Reference and the examples in this topic.

You can also use the statistical eval functions, max and min, on multivalue fields. See Statistical eval functions in the Search Reference.

If you are using Splunk Enterprise, you can configure multivalue fields in the fields.conf file to specify how Splunk software detects more than one field value in a single extracted field value. Edit the fields.conf in $SPLUNK_HOME/etc/system/local/, or your own custom application directory in $SPLUNK_HOME/etc/apps/. For more information on how to do this, see Configure extractions of multivalue fields with fields.conf in the Knowledge Manager Manual.

If your search produces results, such as a table, the results get written to the results.csv.gz file. The contents of the results.csv.gz file include fields that begin with "__mv_". These fields are for internal use only and are used to encode multivalue fields.

For Splunk Cloud Platform, you must create a private app to configure multivalue fields. If you are a Splunk Cloud Platform administrator with experience creating private apps, see Manage private apps in your Splunk Cloud Platform deployment in the Splunk Cloud Platform Admin Manual. If you have not created private apps, contact your Splunk account representative for help with this customization.

Evaluate multivalue fields

One of the more common examples of multivalue fields is email address fields, which typically appear two or three times in a single sendmail event--one time for the sender, another time for the list of recipients, and possibly a third time for the list of Cc addresses.

Count the number of values in a field

Use the mvcount() function to count the number of values in a single value or multivalue field.

In this example, mvcount() returns the number of email addresses in the To, From, and Cc fields and saves the addresses in the specified "_count" fields.

eventtype="sendmail" | eval To_count=mvcount(split(To,"@"))-1 | eval From_count=mvcount(From) | eval Cc_count= mvcount(split(Cc,"@"))-1

This search takes the values in the To field and uses the split function to separate the email address on the @ symbol. The split function is also used on the Cc field for the same purpose.

If only a single email address exists in the From field, as you would expect, mvcount(From) returns 1. If there is no Cc address, the Cc field might not exist for the event. In that situation mvcount(cc) returns NULL.

Filter values from a multivalue field

Use the mvfilter() function to filter a multivalue field using an arbitrary Boolean expression. The mvfilter function works with only one field at a time.

In this example, mvfilter() keeps all of the values for the field email that end in .net or .org.

eventtype="sendmail" | eval email=mvfilter(match(email, "\.net$") OR match(email, "\.org$"))

Note: This example also uses the match() function to compare the pattern defined in quotes to the value of email. See Evaluation functions in the Search Reference.

Return a subset of values from a multivalue field

Use the mvindex() function to reference a specific value or a subset of values in a multivalue field. Since the index numbering starts at 0, if you want to reference the 3rd value of a field, you would specify it as 2.

In this example, mvindex() returns the first email address in the "To" field for every email sent by Sender:

eventtype="sendmail" from=Sender@* | eval to_first=mvindex(to,0)

If you want to see the top 3 email addresses that Sender writes to, use the following search.

eventtype="sendmail" from=Sender@* | eval top_three=mvindex(to,0,2)

In this example, top_three is, itself, a multivalue field.

Manipulate multivalue fields

Use nomv to convert a multivalue field into a single value

You can use the nomv command to convert values of the specified multivalue field into one single value. The nomv command overrides the multivalue field configurations that are set in fields.conf file.

In this example for sendmail events, you want to combine the values of the senders field into a single value.

eventtype="sendmail" | nomv senders

Use makemv to separate a multivalue field

You can use the makemv command to separate multivalue fields into multiple single value fields. In this example for sendmail search results, you want to separate the values of the senders field into multiple field values.

eventtype="sendmail" | makemv delim="," senders

After you separate the field values, you can pipe it through other commands. For example, you can display the top senders.

eventtype="sendmail" | makemv delim="," senders | top senders

Use mvexpand to create multiple events based on a multivalue field

You can use the mvexpand command to expand the values of a multivalue field into separate events for each value of the multivalue field. In this example, new events are created for each value in the multivalue field, "foo".

... | mvexpand foo

Use mvcombine to create a multivalue field from similar events

Combine the values of "foo" with ":" delimiter.

... | mvcombine delim=":" foo

See also

Configure extractions of multivalue fields with fields.conf in the Knowledge Manager Manual.

Evaluate and manipulate fields with multiple values (2024)
Top Articles
Axolotl | Description, Diet, Habitat, & Lifespan
De fascinerende wereld van de Axolotl - Wild uitgelegd
Jordanbush Only Fans
Truist Bank Near Here
Ffxiv Palm Chippings
Frank Lloyd Wright, born 150 years ago, still fascinates
Paris 2024: Kellie Harrington has 'no more mountains' as double Olympic champion retires
Beds From Rent-A-Center
CA Kapil 🇦🇪 Talreja Dubai on LinkedIn: #businessethics #audit #pwc #evergrande #talrejaandtalreja #businesssetup…
Cinepacks.store
Fcs Teamehub
Cars For Sale Tampa Fl Craigslist
A Fashion Lover's Guide To Copenhagen
Alaska BĂĽcher in der richtigen Reihenfolge
Slmd Skincare Appointment
R/Altfeet
Hillside Funeral Home Washington Nc Obituaries
4302024447
Nebraska Furniture Tables
Spartanburg County Detention Facility - Annex I
Moparts Com Forum
Learn2Serve Tabc Answers
Truth Of God Schedule 2023
2016 Hyundai Sonata Refrigerant Capacity
The Grand Canyon main water line has broken dozens of times. Why is it getting a major fix only now?
Wausau Marketplace
Drago Funeral Home & Cremation Services Obituaries
Orange Pill 44 291
Craigslist St. Cloud Minnesota
12 Facts About John J. McCloy: The 20th Century’s Most Powerful American?
E32 Ultipro Desktop Version
Hesburgh Library Catalog
2011 Hyundai Sonata 2 4 Serpentine Belt Diagram
R/Mp5
Shauna's Art Studio Laurel Mississippi
How to Draw a Bubble Letter M in 5 Easy Steps
Lake Dunson Robertson Funeral Home Lagrange Georgia Obituary
Roto-Rooter Plumbing and Drain Service hiring General Manager in Cincinnati Metropolitan Area | LinkedIn
Oreillys Federal And Evans
Radical Red Doc
Stanley Steemer Johnson City Tn
Daly City Building Division
Jack In The Box Menu 2022
Henry Ford’s Greatest Achievements and Inventions - World History Edu
Petra Gorski Obituary (2024)
Hanco*ck County Ms Busted Newspaper
Conan Exiles Tiger Cub Best Food
A jovem que batizou lei apĂłs ser sequestrada por 'amigo virtual'
Dobratz Hantge Funeral Chapel Obituaries
Craigslist Free Cats Near Me
Westport gun shops close after confusion over governor's 'essential' business list
28 Mm Zwart Spaanplaat Gemelamineerd (U999 ST9 Matte | RAL9005) Op Maat | Zagen Op Mm + ABS Kantenband
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6095

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.