Splunk Search

rename the name of a field with the value of another field

marziaolla
Path Finder

Hello there,

After a stats command, I would like to rename the name of a field using a string and the value of another field
eg. fieldname i'd like -> "ABC 2018" but 2018 is stored in a field

I've tried with eval {ABC}="ABC".year but it doesn't work.

can someone help me?
TNX 🙂

0 Karma

woodcock
Esteemed Legend

Like this:

| makeresults
| eval XYZ="123"
| eval year="2018"
| rename StuffBelowIsTheSame AS "rename XYZ AS ABC2018"
| eval newname="ABC" . year
| eval {newname}=XYZ
| fields - newname XYZ

renjith_nair
SplunkTrust
SplunkTrust

@marziaolla,

Try this

| makeresults |eval abc="123",xyz="567"|eval tmp="abc".xyz|eval {tmp}="To be replaced by value of field"|fields - tmp
Happy Splunking!
0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@marziaolla, did it work for you ?

Happy Splunking!
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 ...