Splunk Search

enumerating field names as a new field

akazarov
Path Finder

Dear all,

I have in splunk events of this simple structure fileldX=value, like

field1=..., field2=..., ... fieldN=...

Now I need to plot a stats of my data, something like
| chart avg(?), max(?) over field1, field2,.. fieldN

How should I express the '?'?
Do I need to create a syntetic field with values of my real filed names?

Thanks!

Tags (2)
0 Karma
1 Solution

akazarov
Path Finder

Did it with append:

search ... | chart avg(field1) as f1, avg(field2) as f2 ... | append [ search ... | chart max(field1) as f1, max(field2) as f2... ] | transpose | rename ...

View solution in original post

akazarov
Path Finder

Did it with append:

search ... | chart avg(field1) as f1, avg(field2) as f2 ... | append [ search ... | chart max(field1) as f1, max(field2) as f2... ] | transpose | rename ...

fdi01
Motivator

good Mr akazarov
i don't think like that.

0 Karma

ngatchasandra
Builder

Hi,

Try to enumerate with this: |eval new=mvappend(field1,mvappend(field2,mvappend(field3,field4)))... | makemv delim="," new

0 Karma

fdi01
Motivator

try like this:

...| chart avg(field*), max(field*) over field1, field2,.. fieldN

or

...| chart avg(*), max(*) over field1, field2,.. fieldN
0 Karma

akazarov
Path Finder

over field1, field2
is not valid syntax, it says
Error in 'chart' command: Invalid argument: 'field2'

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...