Splunk Search

perl script

Fabien05
Explorer

Hello all,

I need to create multiple eval fields like this old question:
create-multiple-eval-fields-with-wilcards

Is it possible with a perl script in splunk?

Tags (3)
0 Karma

Gilberto_Castil
Splunk Employee
Splunk Employee

This is ideal for a custom search command in which you can manipulate the data and insert knowledge dynamically. This, however, needs to be done in Python and will require you to follow the rules of integration documented here.

Please see the example in the link provided. In the end, however, it should look something like this:


import sys
import splunk.Intersplunk
import string

results = splunk.Intersplunk.readResults(None, None, True)

for event in results:

    """ data analysis and calculations here """

    ...    

    """ add new field 'newname' """
    event['newname'] = "".join(newval)

splunk.Intersplunk.outputResults(results)

I hope this helps.

0 Karma

Fabien05
Explorer

Thank you, I will try with python because, with perl, I don't see how I can give my splunk table and how I give the results back.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...