Hello everyone, I have such fields in log:
event="some text text2 text3 something something2", how should I make regex formula to match all until 3 or more spaces? for example, for this event it should match "some text text2 text3"
@bosseres Sorry, I tested it like:
because I assumed the actual _raw field / event in Splunk would start like:
"some text text text something something"
is that not correct? thanks
Hi @bosseres,
This will match everything from the start of the event until there are 3 or more spaces:
| rex field=_raw "^(?<description>.+?)\s{3,}"
Thanks,
Jamie
tried so, but..
@bosseres Sorry, I tested it like:
because I assumed the actual _raw field / event in Splunk would start like:
"some text text text something something"
is that not correct? thanks
my raw event in splunk looks like field1="223" field2="333" event="some text text2 text3 something something2"
can you add to this regular formula part, which whill parse field event?
I mean event="..."
^\S*\s\S*\s\S*\s\S*
hm, not working description="(?<description>^\S*\s\S*\s\S*\s\S*") - something wrong?
more, I dont know how many words will be before spaces, I must match all of them
Your requirement is ambiguous. Do you want to include the spaces between words in your count of "three spaces"? Or do you want everything before three consecutive spaces? Also, the carat is in the wrong place when you have put it in an expression, try it this way
"^(?<description>\S*\s\S*\s\S*\s\S*)"
I want everything before three consecutive spaces, but regular still dont work
"description=\"(?<description>.*?)\s{3}"