Splunk Search

How to edit my eval replace / trim statement to format domain information?

tmarlette
Motivator

So I have some domain information that i'm attempting to format appropriately with EVAL functions either replace, or rtrim, and I seem to be having some difficulty.

I'm attempting to shave off the periods before and after the value. Here is the type of values that I'm getting:

query=".www.google.com."

and this is my eval statement so far:

| eval aaa=replace(query, "\".([^\.]+).\", "\1"")

It doesn't seem to be taking, so I was wondering if I'm typoing something somewhere? I simply assume my syntax is wrong. 😃

Thank you!

Tags (3)
0 Karma
1 Solution

sundareshr
Legend

Try `trim(query, "\."). If you prefer replace, then you need to escape the . (period) characters with a \ (backslash)

View solution in original post

sundareshr
Legend

Try `trim(query, "\."). If you prefer replace, then you need to escape the . (period) characters with a \ (backslash)

tmarlette
Motivator

Worked like a charm, thankyou sir! Here was my final eval statement

| eval query=trim(query, "\.\"")
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...