Getting Data In

Where to save the r-code in splunk and how to run the r-code?

satyasai
Engager

Hi,

Where to save the R-code in splunk and how to run the r-code ?

Thanks,
sai

Tags (1)

jkat54
SplunkTrust
SplunkTrust

Splunk doesnt support Ruby scripts out of the box. You have a few options though.

  1. You can wrap your ruby code in a powershell script and setup the powershell script as a scripted input.
  2. You can wrap your ruby code in a batch script and setup the batch script as a scripted input.
  3. You can wrap your ruby code in a python script and setup the python script as a scripted input.

See inputs.conf for configuring scripted inputs.

How do you wrap a script you may ask?

In c:\run_my_ruby.bat you might do this:
c:\path\to\your\ruby.exe your_ruby_code.rb

Then in Splunk inputs.conf you could do this

[script://c:\run_my_ruby.bat]
interval = 60

Then restart splunk and profit. This would execute c:\run_my_ruby.bat every 60s from when splunk is restarted. Check inputs.conf for other interval options.

0 Karma

cmerriman
Super Champion

have you tried using this app to use R
https://splunkbase.splunk.com/app/3339/
personally, I haven't tried using R in Splunk, but I'm not sure if there is a way to save the code in Splunk itself

0 Karma

satyasai022
Engager

In this R-app in which folder i can specify/paste my r-code

0 Karma

cmerriman
Super Champion

I'm not entirely sure, since I haven't used the app myself. the documentation in splunkbase didn't work for me, but I think it's referring to this, if it helps:
https://github.com/opencpu/server-manual/blob/gh-pages/opencpu-server.pdf

0 Karma

satyasai
Engager

I need it in windows can you help me on this

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...