Splunk Search

Why am I not getting the expected output with my current search?

chanduira
Explorer

Hi Experts,

I want to create a trend of UPS load over time.
I can get a UPS overtime trend by getting the sum of three phase inputs (with average of each phase) (ABC_PH1_UPS1_L1_OUTPWR, ABC_PH1_UPS1_L2_OUTPWR, & ABC_PH1_UPS1_L3_OUTPWR)

While I am doing timechart, I am not getting any output:

index=abc sourcetype=csv ABC_PH1_UPS1_*_OUTPWR | stats avg(Parameter Value) as Value by "Meter Name"| replace ABC_PH1_UPS1_L1_OUTPWR with UPS1, ABC_PH1_UPS1_L2_OUTPWR with UPS1, ABC_PH1_UPS1_L3_OUTPWR with UPS1 in "Meter Name"| timechart sum(Value) as Val by "Meter Name"
0 Karma
1 Solution

fdi01
Motivator

try whith "..." like:
...| stats avg("Parameter Value") as Value by "Meter Name"|...

View solution in original post

0 Karma

chanduira
Explorer

I tried with addcols option its working

0 Karma

fdi01
Motivator

try whith "..." like:
...| stats avg("Parameter Value") as Value by "Meter Name"|...

0 Karma

javiergn
Super Champion

I've got a feeling that you need double quotes when calculating the avg of Parameter Value:

index=abc sourcetype=csv ABC_PH1_UPS1_*_OUTPWR | stats avg('Parameter Value') as Value by "Meter Name"| replace ABC_PH1_UPS1_L1_OUTPWR with UPS1, ABC_PH1_UPS1_L2_OUTPWR with UPS1, ABC_PH1_UPS1_L3_OUTPWR with UPS1 in "Meter Name"| timechart sum(Value) as Val by "Meter Name"

martin_mueller
SplunkTrust
SplunkTrust

Referring to a field name with nonstandard characters needs single quotes in eval, double quotes in stats - double quotes in eval give you a string.

That being said, avg(Parameter Value) is indeed not going to work, double quotes are needed.

javiergn
Super Champion

True, i'll fix my answer, thanks

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...