Reporting

How to replace number field values with a string?

yvassilyeva
Path Finder

Hi! I am trying to rename field values from a number to a string like this:

I calculated whether the project has been past due or not by subtracting today's date minus project ask date: 

| eval "Past/Future"=round(abs((relative_time(now(), "@d")-relative_time(strptime(project_ask_date,"%Y-%m-%d %H:%M:%S"), "@d"))/86400),0) 

Now i want to rename the field values: 

If the number is >0 then it is past due, otherwise the project's due date is in the future. 

Thank you!

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

To be picky, rename changes the name of a field rather than change the value itself.  To change a value you can use eval.  BTW, I used a different field name because slashes are not valid field name characters.

... | eval PastFuture = if(PastFuture>=0, "Past Due", "Future")

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

To be picky, rename changes the name of a field rather than change the value itself.  To change a value you can use eval.  BTW, I used a different field name because slashes are not valid field name characters.

... | eval PastFuture = if(PastFuture>=0, "Past Due", "Future")

 

---
If this reply helps you, Karma would be appreciated.

yvassilyeva
Path Finder

Thank you! 

0 Karma
Get Updates on the Splunk Community!

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...