Splunk Search

What is the best way to count case sensitive characters in a value?

Mr_Forensics
Engager

Hello Team,

I am interested in determining the best way to count the number of case sensitive letters and special characters for each value.

Examples:

- PoWERshell  = 4 uppercase and 6 lowercase and 0 special characters

- Powershell = 1 uppercase and 9 lowercase and 0 special characters

- Power`SHell = 3 uppercase and 7 lowercase and 1 special charater

For each value in the same field, is it possible to count this and create a field value pair for it?

The desired table would be the following fields:

(Original Feild value) (count of uppercase letters) (count of lower case letters)  (special characters count)

Example output: Power`Shell --- 2--- 8---1

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Here is one way

| rex max_match=0 "(?<upper>[A-Z])"
| rex max_match=0 "(?<lower>[a-z])"
| eval count_upper=mvcount(upper)
| eval count_lower=mvcount(lower)
| eval count_special=len(_raw)-count_upper-count_lower

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Here is one way

| rex max_match=0 "(?<upper>[A-Z])"
| rex max_match=0 "(?<lower>[a-z])"
| eval count_upper=mvcount(upper)
| eval count_lower=mvcount(lower)
| eval count_special=len(_raw)-count_upper-count_lower
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...