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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...