All Apps and Add-ons

When trying to run curl command on Windows, why do I receive "'rex' is not a recognizable command" error?

santoshdvn
New Member

Hi ,

I am trying to run curl command on windows command prompt . I am getting following error at 'rex' in the search query

curl -k -u admin:pass -d search=" search (host=xxxx-xxxx-xxxx) | rex field=_raw mode=sed \"s/abc/'/g\" "  -d "output_mode=csv" http://localhost:8089/servicesNS/admin/search/search/jobs/export

I am getting following at 'rex'

'rex' is not recognizable command 

Thanks,
Santosh

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It sounds like Windows is processing the pipe character within the search query instead of passing it on as part of the curl command. Try escaping the pipe.

curl -k -u admin:pass -d search=" search (host=xxxx-xxxx-xxxx) ^| rex field=_raw mode=sed \"s/abc/'/g\" "  -d "output_mode=csv" http://localhost:8089/servicesNS/admin/search/search/jobs/export
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...