Splunk Search

How do I use the eval "lower" function to make a field lowercase?

IRHM73
Motivator

Hi, I wonder whether someone may be able to help me please.

I'm trying to make changes to the partial script below to make the field "inFullName" lowercase.

index=main auditSource="matching" auditType="Tx*"
 | rex "IncomingSearchRequest\(Some\((?<inNINO>[^\)]+)\),Some\((?<inFName>[^\)]+)\),Some\((?<inSName>[^\)]+)\),Some\((?<inDOB>[^\)]+)\)\)"
 | eval date=inDOB | eval inDOB=replace(inDOB,"(\d+)-(\d+)-(\d+)","\3/\2/\1") 
 | eval inFullName= inFName." ".inSName 
 | eval inFull_Details= "FullName: ".inFullName.", NINO: ".inNINO.", DOB: ".inDOB
 | makemv delim=", " inFull_Details

I've tried using | eval inFullName=lower(inFullName) at multiple points in the search, but the field fails to display any data, so somewhere along the lines I've gone wrong.

Could someone have a look at this please and let me know where I've gone wrong?

Many thanks and kind regards

Chris

1 Solution

sundareshr
Legend

What values do you have for inFullName?. I just tried this and it works as expected

| gentimes start=-1 | eval inFName="Mother" | eval inSName="THeresa" | eval inFullNameUL= lower(inFName)." ".upper(inSName) | eval inFullNameL=lower(inFullNameUL) | table inFName inSName inFullNameL inFullNameUL

View solution in original post

woodcock
Esteemed Legend

It is hard (impossible) to say without sample event data.

0 Karma

IRHM73
Motivator

Hi @woodcock, thank you for taking the time to come back to me with this. You'll see from my comment above that I was able to use the solution provided by @sundareshr.

Many thanks and kind regards

Chris

0 Karma

sundareshr
Legend

What values do you have for inFullName?. I just tried this and it works as expected

| gentimes start=-1 | eval inFName="Mother" | eval inSName="THeresa" | eval inFullNameUL= lower(inFName)." ".upper(inSName) | eval inFullNameL=lower(inFullNameUL) | table inFName inSName inFullNameL inFullNameUL

IRHM73
Motivator

Hi @sundareshr, thank you for taking the time to reply to my post.

Could you perhaps explain to me what "gentimes start=-1" does, because when I used this I received an error message.

Anyway with some tweaks to fit in with the data I need I used | eval inFullNameL= lower(inFName)." ".lower(inSName) and it worked perfectly.

If you want to change this to an answer I can accept this.

Many thanks and kind regards

Chris

0 Karma

sundareshr
Legend

@IRHM73, Converted to answer. I used gentimes (http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/Gentimes) only to provide a run-anywhere example. It has not relevance to your search.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...