Getting Data In

How to rename dynamic input results

lyf1995123
Engager

Sorry, I am new to Splunk. Now I use a dynamic dropdown to generate all the results, like below:

index=dev-app host=hadoopdn* $importids$ $batchids$ $stages$ |stats count by groupName

Now the query result is like:

FileSystemCounters   10
*.FileType        14
*.StatsCounters      3
*$Counter           6

The problem is the prefix is too long to display.
Is there a way that can only display the latter part?
Like "StatsCounters" instead of "*.StatsCounters"
Maybe use an alias?

0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@lyf1995123,

If you have a pattern in the group name , you could use regex to extract it.

For e.g. from your above examples

     index=dev-app host=hadoopdn* $importids$ $batchids$ $stages$ |stats count by groupName
    | rex field=groupName "\*?[.$]?(?<groupName >\w+)"
Happy Splunking!

View solution in original post

0 Karma

lyf1995123
Engager

What I want is the result generated like this: stats count by groupName |rex field=groupName mode=sed "s/^\w.+./""/g"

0 Karma

evania
Splunk Employee
Splunk Employee

Hi @lyf1995123 ,

Did you have a chance to check out an answer? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you.

Thanks for posting!

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@lyf1995123,

If you have a pattern in the group name , you could use regex to extract it.

For e.g. from your above examples

     index=dev-app host=hadoopdn* $importids$ $batchids$ $stages$ |stats count by groupName
    | rex field=groupName "\*?[.$]?(?<groupName >\w+)"
Happy Splunking!
0 Karma

lyf1995123
Engager

Inspired by your answer, I think what I am looking for is like "stats count by groupName |rex field=groupName mode=sed "s/^\w.+./""/g"".
And it worked as I expected. But thanks still.

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 ...