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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...