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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...