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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...