Giter Site home page Giter Site logo

customsplunkcommands's Introduction

customsplunkcommands

Collection of custom built Splunk commands

rediscacheget.py

This is a custom lookup command which enables Splunk to connect to a Redis cache to lookup field values.

To use, copy the rediscacheget.py file either to an application or the default search application into the bin folder e.g. $SPLUNK_HOME/etc/app/search/bin

Edit transforms.conf to tell Splunk to use the cacheget.py file as a lookup command:

[rediscachelookup]                                                                                                                            
external_cmd = rediscacheget.py                                                                                                              
fields_list = [INSERT FIELDS TO LOOKUP HERE]

Then restart Splunk for the changes to take effect.

makotransform.py

This is a custom search command which takes any field as an input (defaults to _raw) and runs a Mako transform on the field producing a new field with the transformed output as it's value.

To use copy the makotransform.py file to either an application or the default search application into the bin folder e.g. $SPLUNK_HOME/etc/app/search/bin

Edit commands.conf to tell Splunk where to find the command script:

[makotransform]
filename = makotransform.py

Templates should be placed in the $APP_HOME/templates and named .txt e.g. $SPLUNK_HOME/etc/app/search/templates/mytemplate.txt

Then restart Splunk for the changes to take effect.

This command has a number of uses for example you could create a html email message template and populate it with an error message e.g.

search index=someindex error=* | makotransform template=mytemplate fields="host,error" outfield=emailtosend

<html>
<body>
    <p>An error has occurred - ${error} on host ${host}</p>
</body>
</html>

This will produce a field for each error event called emailtosend which could then be piped to an alert command.

customsplunkcommands's People

Contributors

benbramley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.