Splunk Search

Concatenate fields into string on form

timmy13
Communicator

I want a form that will allow a user to "build" the appropriate "source" (or log file name) based on selecting various pieces of data.

So the fields will be like this:

Date
Application
Server

I want to then build a string to use in the search.

Trying to use eval but getting now where....

sourcetype=MySourceType | eval sourcelog=Date."-".Application."-".Server.".log" |search source=sourcelog

This always returns 0 results. If I leave out the search function, the sourcelog field is populated.

Once I can get this search to work, I can use it in the populatingsearch function of the form.

Ideas?

hazekamp
Builder

When comparing two fields you want to use the where command instead:

sourcetype=MySourceType | eval sourcelog=Date."-".Application."-".Server.".log" | where source=sourcelog

timmy13
Communicator

Great hazekamp, thanks for the help. That works, but I still have a problem.

Of course, when defining source=, I can use wild cards. However, when I place wildcards into sourcelog, and then use the where source=sourcelog command, it fails. seems the where doesn't like wildcards.

Ideas?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...