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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...