Dashboards & Visualizations

Get the value after first occrured * in a string

arjun_krishna
Explorer

I am having below logs, want to create chart for number of activities done on weekday
log1:
index="abc_xyz" |activity="/google.com*bookstore" |eventEndTime=2018-09-27
log2:
index="abc_xyz" |activity="/yahoo.com*groceryStore" |eventEndTime=2018-09-26
log3:
index="abc_xyz" |activity="/bing.com*wineStore" |eventEndTime=2018-09-22

I am came up with below query, but i need a regex to get value after the 1st occured "*" (ex: bookstore, groceryStore, wineStore) in activity2 and want to get count of that activity2 based chart

index="abc_xyz" activity="/google.com*bookstore" earliest=-14d latest=-0d | chart count(activity) over date_hour by date_wday

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

To extract activity2, try this

... | rex field=activity "\*(?<activity2>\w+)" | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...