Splunk Search

How to rename a dynamic header name?

Uwbspeicher
New Member

Hi, I need to format a search very specifically so that the client's automation receives a report correctly. All I need is to rename a field name to a value with strftime(now(), "%Y%m%d") in it, but the rename command doesn't seem to support that. Any way that I can make this value my header without altering the data?

0 Karma
1 Solution

sbbadri
Motivator

@Uwbspeicher

please try this,

| eval today=strftime(now(),"%Y%m%d") | eval {today}=yourfieldheadername | fields - today yourfieldheadername

View solution in original post

0 Karma

sbbadri
Motivator

@Uwbspeicher

please try this,

| eval today=strftime(now(),"%Y%m%d") | eval {today}=yourfieldheadername | fields - today yourfieldheadername

0 Karma

Uwbspeicher
New Member

That worked, thank you! Never seen the curly braces before; those are helpful.

0 Karma

niketn
Legend

@Uwbspeicher, can you share your existing query? The rename/re-format might be possible before the final transforming command.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...