Splunk Search

CMD search not working

tkwaller
Builder

Tryin to run a quick test of a search from the command line(Putty) NOT CLI results in command not found. I know I'm probably doing something wrong but cant figure out what. I've looked at all of the docs I could find but still can't get it to work. I've tried several different ways but still get same results. Any ideas?

[root@8 /]# splunk search 'index=_internal | dedup host | table host' index_earliest -60sec index_latest -now
-bash: splunk: command not found
[root@8 /]# splunk search "index=_internal | dedup host | table host" index_earliest -60sec index_latest -now
-bash: splunk: command not found

Thanks for the help!

Tags (2)
0 Karma
1 Solution

MuS
Legend

Hi tkwaller,

if Splunk is installed with default options, try something like this:

/opt/splunk/bin/splunk search 'index=_internal index_earliest -60sec index_latest -now | dedup host | table host' 

or add /opt/splunk/bin to your OS path environment and you can run it like this:

splunk search 'index=_internal index_earliest -60sec index_latest -now | dedup host | table host' 

Hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi tkwaller,

if Splunk is installed with default options, try something like this:

/opt/splunk/bin/splunk search 'index=_internal index_earliest -60sec index_latest -now | dedup host | table host' 

or add /opt/splunk/bin to your OS path environment and you can run it like this:

splunk search 'index=_internal index_earliest -60sec index_latest -now | dedup host | table host' 

Hope this helps ...

cheers, MuS

tkwaller
Builder

It was indeed me not including /opt/splunk/bin/ before splunk, I knew it was something simple like that. This one worked perfectly: /opt/splunk/bin/splunk search 'index=_internal index_earliest -60sec index_latest -now | dedup host | table host'

Thank you sir!

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...