Splunk Search

How to rename multiple field names with certain criteria

HattrickNZ
Motivator

How do I replace the MB in each field name with GB ??

_time   XXX-XX-MB   XXX-XXX-MB  XXXXXXMB_XX_XXX
1   2017-07-30 11:00    1391.67548628852    1381.60821617188    1274.532780647
2   2017-07-30 12:00    1509.29349191985    1503.65362613860    1373.894662857

So my result would look like this:

_time   XXX-XX-GB   XXX-XXX-GB  XXXXXXGB_XX_XXX
1   2017-07-30 11:00    1391.67548628852    1381.60821617188    1274.532780647
2   2017-07-30 12:00    1509.29349191985    1503.65362613860    1373.894662857

I can already change all the field values with this command and was thinking I could do something similar with the field names.
foreach * [eval <<FIELD>>='<<FIELD>>'/1024] |

HiroshiSatoh
Champion

try this!

(your search)|rename *_mb* as *_gb*|foreach *_gb* [eval <<FIELD>>='<<FIELD>>'/1024]
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...