Splunk Search

Simple example of passing Splunk search results to an R script and displaying the results?

jburman123
Explorer

The example provided by SPLUNK for an R script uses the addr.r script that does not use SPLUNK search results. Can you provide a very simple example of a R script that ingests SPLUNK search results and passes them to the script and displays the result?

Tags (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

I used Splunk search to feed FFT here: http://answers.splunk.com/answer_link/149675/.

A really basic test to understand input from Splunk is to run

| r "output=input"

input is a data frame composed of your search results as well as some Splunk implicit fields. (Data frame is the biggest revelation to me, thanks to @rfujara_splunk.) All fields are prefixed with "X". For example, X_time is Splunk _time, X_span is Splunk _span if you used timechart or bucket; if your search outputs a field host, R sees it as Xhost.

output is the data frame to send back to Splunk. Each component name is used as a field name by Splunk.

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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...