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
Legend

@marziaolla,

Try this

| makeresults |eval abc="123",xyz="567"|eval tmp="abc".xyz|eval {tmp}="To be replaced by value of field"|fields - tmp
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

renjith_nair
Legend

@marziaolla, did it work for you ?

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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