Split & Index Issue in Graylog 2.0.4

Hi,

I want to split this string by ‘/’ and get the first element :

/ecm-core/getReferentialNamesYouNeed/flashL/flashP

When I set the ‘Split by’ with / I get a message error. Please check the first image

When I escape the /, and setting "Split by’ with /, not split is made. Please check the second image.

What’s the right way to make this simple split :frowning: ?

Many Tanks

It’s pretty unintuitive, but you’re using the wrong target index.

Using "/" (not "\/") will split the string “/ecm-core/getReferentialNamesYouNeed” into the following components:

  1. “” (empty string, because that’s what is in front of the first split character)
  2. “ecm-core”
  3. “getReferentialNamesYouNeed”

So you need the target index 2 (“ecm-core”), not 1 (empty string).

Thanks. Comparing to java way is really unintuitive as you say :wink: Thanks again

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.