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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...