Splunk Search

splunk merge field values

viku7474
Explorer

I have a field called environment which has values like dev,prod,uat,sit.
Now I want to create a new_field which all the field values of environment field.

Example: (4 field values)
environment 
dev
prod
uat
sit

After query: ( 1 field value, separated by any string)
merge_environment= dev | prod | uat | sit

How to achieve this?

Labels (6)
Tags (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Space separated

| stats values(environment) as merge_environment
| nomv merge_environment

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Space separated

| stats values(environment) as merge_environment
| nomv merge_environment
0 Karma

viku7474
Explorer

@ITWhisperer  Thank you!!

It works, Since I am passing this token in mail subject, can I separate it by comma or hyphen.?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Instead of using nomv, try this

| eval merged_environment=mvjoin(merged_environment, ",")
0 Karma
Get Updates on the Splunk Community!

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...