Splunk Search

issue in rex query

roopeshetty
Path Finder

Hi Guys,
I have a log as below;

server1;443 status= running.
server2;443 status= running.
server3;443 status= running.
server4;443 status= running.

In this I need to create a field by name “ServerName” by targeting all server names as its values example server1, server2, server3 etc.

I am running the rex query as below;
|rex "(?.*);443"

now i am getting the expected result but an additional text lines will be added onto its values as below;

Message=server1
Message=server2
Message=server3
Message=server4

Any idea from where this word “Message=” is being added to these values as prefix and how can we remove it?

Tags (1)
0 Karma

vnravikumar
Champion

Hi @roopeshetty

Try with

^(?P<ServerName>.*);\d
0 Karma

renjith_nair
Legend

@roopeshetty ,

Looks like your group filed was removed from the question. Try to add code formatting whenever you add search strings.

Nevertheless, try this

rex "(?<server>.+);443"
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

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

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...