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 ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...