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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...