Splunk Search

How to use Collect to push the Host, Source and Sourcetype from the Original index ?

sagrl
Explorer

I want to use the collect command and want to push the Host, source and source-type coming from the Original index.

index=sm sourcetype=mysqld 
| eval host1=host 
| eval index1=index 
| eval sourcetype1=sourcetype 
| eval source1=source 
| collect index="test" source=source1

It is pushing "source1" string instead of its actual value any idea how to send the actual dynamic value ?

Tags (1)
0 Karma

FrankVl
Ultra Champion

host, source and sourcetype attributes of the collect command are string attributes, so I don't think you can put field references in there. Doesn't collect retain the existing host and source values anyway? Sourcetype will be changed to stash by default.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...