Splunk Search

string fields with numbers to be compared

Hema_Nithya
Explorer

I have another issue in comparing and want to compare should_be with server_installed_package . Sometime package installed is higher after patching . Example given below for git version if should_be== server_installed_package  , the status should updated as Completed 
, Another case if server_installed_packages is greater than shouldbe to mark as complete 2 < 3 ,  also it should check for if first number is same , it should check for second digits . it should mark as completed , else it should check for the next digit if it is 2. and it should check for another number . 

 

CIInstalled shouldbeserver_installed_packageStatus 
server1git-2.31.1-3.el8_7git-2.39.3-1.el8_8git-3.40.3-1.el8_8Not complete
Labels (4)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Hema_Nithya ,

this check highly depends on the format of the version, so if the format is always the one you shared (git-2.31.1-3.el8_7 and git-2.39.3-1.el8_8), you could use a regex to extract the numeric version:

| rex field=installed ".*(?<version_installed>\d+_\d+)"
| rex field=shouldbe ".*(?<version_shouldbe>\d+_\d+)"

so you can compare them.

Ciao.

Giuseppe

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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...