Filter in grok - or _


(Luis) #1

Hello!!!

Is there a way to filter this in grok:

BMDL_DEV/4.BMDL_TEST_HELLOWORLD_DOCKER"

I am trying to break it in pieces but no luck

match => ["jenkins_jobname", "(?<jenkins_jobnameenv>.(\S*.))(?<__forwardslash>.(/+))%{NUMBER}.(?<jenkins_repo>.(\S))" ]

i would like to form the following but no luck

BMDL
_ or -
DEV
/
4
.
BMDL_TEST_HELLOWORLD_DOCKER

Thank you for the help, I really appreciate it


#2

I cleaned it up a little. I'm not sure how you wanted the result to look like (Did you really want to extract the slash? Does the name always contain BMDL and DEV? etc. ...). But maybe this can help.

(?<jenkins_jobnameenv>\S*[-_]\S*)/+%{NUMBER}\.(?<jenkins_repo>\S*)

{
  "jenkins_jobnameenv": [
    [
      "BMDL_DEV"
    ]
  ],
  "NUMBER": [
    [
      "4"
    ]
  ],
  "BASE10NUM": [
    [
      "4"
    ]
  ],
  "jenkins_repo": [
    [
      "BMDL_TEST_HELLOWORLD_DOCKER"
    ]
  ]
}

(Luis) #3

thank you!! :slight_smile:


(system) #4

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