Split & Index Issue in Graylog 2.0.4

(Fadjer) #1


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


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

(Jochen) #2

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).

(Fadjer) #3

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

(system) closed #4

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