Refine your search:

Hi,

does Splunk has a possibility to run server side scripts (python, ruby) based on a splunk search result? The search output should be the input (e.g. a number or list of numbers) for the server side script.

Something like this: ... | fields X | my_server_script X

Thanks!

asked 03 Mar '11, 14:27

lwalhoefer's gravatar image

lwalhoefer
134
accept rate: 0%

edited 03 Mar '11, 18:30

piebob's gravatar image

piebob ♦♦
4.6k41023


2 Answers:

This should be possible by defining a custom search command. Your new search command extends the Splunk search language, and Splunk uses your new command by calling the script that implements it. Some of the existing commands in Splunk (iplocation) are implemented using this facility. These scripts are currently expected to be python scripts. A "runshellscript" command exists in my $SPLUNK_HOME/etc/apps/search/default/commands.conf that looks somewhat interesting.

Your command would receive a stdin dump of the current search results, which you could do as you please with.

Docs at http://www.splunk.com/base/Documentation/latest/SearchReference/Aboutcustomsearchcommands

link

answered 03 Mar '11, 14:33

dwaddle's gravatar image

dwaddle ♦
15.4k2924
accept rate: 33%

you could also define a scripted alert that fires off a script using search results when a set condition is met:

http://www.splunk.com/base/Documentation/latest/Admin/Configurescriptedalerts

link

answered 03 Mar '11, 15:51

piebob's gravatar image

piebob ♦♦
4.6k41023
accept rate: 29%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×395
×105
×57
×9

Asked: 03 Mar '11, 14:27

Seen: 1,268 times

Last updated: 03 Mar '11, 18:30

Copyright © 2005-2012 Splunk Inc. All rights reserved.