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!

How to Get Started with Splunk Data Management Pipeline Builders (Edge Processor & ...

If you want to gain full control over your growing data volumes, check out Splunk’s Data Management pipeline ...

Out of the Box to Up And Running - Streamlined Observability for Your Cloud ...

  Tech Talk Streamlined Observability for Your Cloud Environment Register    Out of the Box to Up And Running ...

Splunk Smartness with Brandon Sternfield | Episode 3

Hello and welcome to another episode of "Splunk Smartness," the interview series where we explore the power of ...