All Apps and Add-ons

Why is the R Project app not able to find find opencpu?

splunkannm1
New Member

I have R (3.3.1) and opencpu (1.6.7) installed on a Linux server and we have R Project app installed on our search head as well as indexer. The Search head has connectivity to the R server via a firewall request. Below are the searches and the resultant errors.

index=sd sourcetype=sd | runRdo script="return(dataset);"
• Could not locate the time (_time) field on some results returned from the external search command 'runrdo'.
: External search command 'runrdo' returned error code 1. Script output = "error_message=TypeError at "/opt/splunk/var/run/searchpeers/-1491865248/apps/ita_r/bin/r_do_call.py", line 38 : float() argument must be a string or a number "

|inputlookup r_test.csv | runRdo script="return(dataset);"

status    session  message
400        0       there is no package called 'ocpu' In call: find.package(pkgname, lib.loc = lib.loc)

For your reference in Linux :

whereis R
R: /usr/bin/R /usr/lib64/R /usr/include/R /usr/share/R /usr/share/man/man1/R.1.gz
whereis opencpu
opencpu: /usr/lib/opencpu /etc/opencpu

Any suggestions ?

Tags (2)
0 Karma
1 Solution

gwobben
Communicator

Hi!

Thanks for using the R app. First of all you should not install the app on indexers. The calls to the R server cannot (and should not) be made by multiple machines.

There is a few things to check / debug:
1. Is OpenCPU running? It should run as a webserver on your Linux machine. The way to test this is to get a browser and navigate to http://[address_of_your_Linux_machine]:[port]/ocpu (the port should by default be 8004). You should see the OpenCPU web interface.
2. R will not handle fields with an _ (underscore) very well. You should avoid using them, e.g. by renaming them before sending to R.
3. Give this query a try: | makeresults | eval test = "test" | table test | runRdo script="return(dataset);" (tested and works on my machine). This will make sure it's not your input data that's causing the problem.
4. Make sure you've configured the R app properly (in your local or default folder, look for rsetup.conf and make sure it contains the url of the machine that runs OpenCPU (http://[address_of_your_Linux_machine]:[port])

I hope this helps...

Gijs

View solution in original post

0 Karma

habib_hussain
New Member

Hi Gjis,

Does this work only for R server? I tried R studio and it seems, its not working.

Thanks,
Habib
,Hi Gjis,

Can I use R studio instead of R server?
Seems like it does not work for R studio. Or am I doing something wrong?

Thanks
Habib

0 Karma

richgalloway
SplunkTrust
SplunkTrust

@habib_hussain This question is over a year old with an accepted answer so it is effectively ended. Please post a new question.

---
If this reply helps you, Karma would be appreciated.
0 Karma

gwobben
Communicator

Hi!

Thanks for using the R app. First of all you should not install the app on indexers. The calls to the R server cannot (and should not) be made by multiple machines.

There is a few things to check / debug:
1. Is OpenCPU running? It should run as a webserver on your Linux machine. The way to test this is to get a browser and navigate to http://[address_of_your_Linux_machine]:[port]/ocpu (the port should by default be 8004). You should see the OpenCPU web interface.
2. R will not handle fields with an _ (underscore) very well. You should avoid using them, e.g. by renaming them before sending to R.
3. Give this query a try: | makeresults | eval test = "test" | table test | runRdo script="return(dataset);" (tested and works on my machine). This will make sure it's not your input data that's causing the problem.
4. Make sure you've configured the R app properly (in your local or default folder, look for rsetup.conf and make sure it contains the url of the machine that runs OpenCPU (http://[address_of_your_Linux_machine]:[port])

I hope this helps...

Gijs

0 Karma

splunkannm1
New Member

Thank you Gijs, #4 was the issue. I had the ocpu/library after the address for the rsetup.conf. Removed it and it works.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...