Splunk Search

Standardizing field values

tanyongjin
Explorer

I have field values that are the same as each other but in different cases.

How can I standardize them to prevent inconsistencies in my results?

Thank you,

0 Karma

DalJeanis
Legend

I'm going to assume that you have some fields that contain both "No" and "no" as potential values.

1) Before running a stats (or similar aggregation command), you should take each such field and apply either the upper or lower command to the field, such as

| eval myfield = lower(myfield)
| stats count by myfield

2) When using a rex or regex or match command on the field, at the front of the regular expression, add the flag "(?i)" to do case-insensitive matching.

| regex AnotherField="(?i)yes"

which is equivalent to

| regex AnotherField="(yes|yeS|yEs|yES|Yes|YeS|YEs|YES)"
0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...