Splunk Search

How to remove everything after a specific character in a line and group by that value?

ruhjuh
Explorer

I'm trying to remove everything after the first colon that appears in a line and group by that value.

An example of the data:

ComputerName; User1: your job has been processed.
ComputerName; User3: your job has failed.
ComputerName; User2: your job is processing. 

I'm able to remove the computer name using:

| rex "ComputerName;(?<UsersPlus>[^$]+)"

However, I'm not sure how to keep the username and remove everything after the colon so I can group by the username, (User1, User2, and User3)

Any help would be much appreciated.

0 Karma
1 Solution

sundareshr
Legend
ComputerName;\s?(?<UsersPlus>[^:]+)

View solution in original post

sundareshr
Legend
ComputerName;\s?(?<UsersPlus>[^:]+)

ruhjuh
Explorer

Thanks, this worked beautifully.

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