All Apps and Add-ons

Having some trouble with sub searches and makemv/mvexpand

sunnyd
Engager

Im trying to do some data mining on twitter for a project. I trying to find keywords that are most popular, and then remove the stop words using a CSV lookup.

Here is my query:

index=football-twitter lang=en earliest=-15m@m latest=@m
| eval foo=text
| makemv foo
| mvexpand foo
| search foo NOT
    [ 
    | inputlookup StopWords.csv 
    | rename Words AS foo ]
| top foo limit=1
| table foo

This does not work.

but if I use a slightly different query, it works.

index=football-twitter lang=en earliest=-15m@m latest=@m
| makemv text
| mvexpand text
| search text NOT
    [ 
    | inputlookup StopWords.csv 
    | rename Words AS text ]
| top text limit=1
| table text

What I want to do, is create a time chart of the usage of the top keyword, and also use the sentiment app to generate a sentiment time chart . Something like -

index=football-twitter lang=en
    [search index=football-twitter lang=en earliest=-15m@m latest=@m
    | makemv text
    | mvexpand text
    | search text NOT
        [ 
            | inputlookup StopWords.csv 
            | rename Words AS text ]
    | top text limit=1
    | table text] 
| sentiment twitter text
| timechart avg(sentiment)

but the query above does not seem to work either.

Any help would be greatly appreciated.

Thanks!

0 Karma

woodcock
Esteemed Legend

Sometimes you will have problems with eval if you do not put the RHV string-literal in double-quotes. For example, try this:

... | inputcsv YourFile.csv | eval newField=ThisIsAValueNotAFieldName

The above will NOT create newField but the following will:

... | inputcsv YourFile.csv | eval newField="ThisIsAValueNotAFieldName"

So try changing this part:

| eval foo=text

To this:

| eval foo="text"
0 Karma

woodcock
Esteemed Legend

Did this work for you?

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!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

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

Ready to make your IT operations smarter and more efficient? Discover how to automate Splunk alerts with Red ...