Dashboards & Visualizations

Splunk Custom Command Trimming Spaces in Fields

Arun_N_00007
New Member

Hi All,

I observed in Splunk Query Language that,

  • Any field’s values are getting trimmed after going through Splunk’s Custom Command’s execution.
  • Commands are developed using Splunk’s API and we are not touching those fields inside the command.
  • In configurations(commands.conf) found there is no such property values which can avoid this.

 

With Custom Command

With Custom Command.jpg

Without Custom Command

Without Custom Command.jpg

Custom Command Code,

import splunk.Intersplunk

results,unused1,unused2 = splunk.Intersplunk.getOrganizedResults()

keywords, argvals = splunk.Intersplunk.getKeywordsAndOptions()

field = argvals.get("field")

for r in results:

    try:

        r[field] = r[r[field]]

    except Exception, e:

        r[field] = None

splunk.Intersplunk.outputResults(results)

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...