Getting Data In

Perl script output instead of shell

yadvendra
New Member

Hello There,

I wanted to use Perl script instead of shell script for the scripted output.

I put my shell perl script @ same place where other shell scripts are available.

but I am not able to get input from Perl script in splunk.

Kindly help!!

Following is the output of my perl script, which I want in splunk

mm174:/var/tmp/yad/splunk/etc/apps/Mediation/bin# /var/tmp/yad/read_bgwConfig.pl
SERVER INBUFFER OUTBUFFER
Telstra 0 2
ServerNN 0 0
Server2 0 2
Server3 0 0
Server1 4 6
Server4 0 0

Tags (2)
0 Karma

yadvendra
New Member

Thanks a Lot for your help!

Well I was able to run the scripts from the directories.

However was confused if I can user perl script or not for the same.

Now I am able to use Perl Script and getting the output in the splunk

Thanks For your help

0 Karma

linu1988
Champion

if you have the script and it's echoing you some output in the window then it will be sent to splunk

0 Karma

jpass
Contributor

Would you please post the answer so other visitors looking for the same solution can find it? I'm trying to do the same thing myself. I've done this previously but didn't need to return anything back to splunk. Now I need to return the output of the script back to splunk.

0 Karma

Ayn
Legend

Your script needs to reside inside a directory that Splunk allows script execution in. From the inputs.conf docs:

[script://<cmd>]
* Runs <cmd> at a configured interval (see below) and indexes the output.  
* The <cmd> must reside in one of 
  *  $SPLUNK_HOME/etc/system/bin/
  *  $SPLUNK_HOME/etc/apps/$YOUR_APP/bin/
  *   $SPLUNK_HOME/bin/scripts/

yadvendra
New Member

I also tried to call it like this

sb6270x1813:/var/tmp/yad/splunk/etc/apps/Mediation/bin# cat fe_buffer.sh

!/bin/bash

perl read_bgwConfig.pl

However did not work.

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!

Ditch the Manual Grind: Building AI Agents with Splunk

Ditch the Manual Grind: Building AI Agents with Splunk Let’s be real: your team’s time is being eaten alive. ...

Cisco Data Fabric from Architecture to Investigation, Better SOC Visibility, and More ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

The Trust Gap: Why a Data Foundation is Fundamental to an Agentic Enterprise

The Trust Gap: Why a data foundation is fundamental to an  Agentic Enterprise.   Agentic AI is transforming ...