Splunk Search

splunk app for NLP : trying to get average sentiment by index

denymw
Explorer

Hi, I am trying to get a visualization to show the average sentiment of a search term by the index.

index=* foo | table text| vader textfield=text| stats avg(sentiment) as sentiment

as expected gives me a decimal return labelled sentiment

index=* foo | table text| vader textfield=text| stats avg(sentiment)

returns the same decimal unlabeled

but I can not get
index=* foo | table text| vader textfield=text| stats avg(sentiment) by index

to return a sentiment decimal based on the results from the different indexes, I am obviously going wrong somewhere but I can not work out where, any help is greatly appreciated.

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@denymw,

In your search, you are using | table text which restricts the fields to only text. If you need index also part of your stats , add index also to the table command or remove the table command completely.

Try

index=* foo | vader textfield=text| stats avg(sentiment) as sentiment by index
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@denymw,

In your search, you are using | table text which restricts the fields to only text. If you need index also part of your stats , add index also to the table command or remove the table command completely.

Try

index=* foo | vader textfield=text| stats avg(sentiment) as sentiment by index
---
What goes around comes around. If it helps, hit it with Karma 🙂

denymw
Explorer

thank you so much, I didn't even see I had copied that in.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...