I cant parse with grok


(Jose Joaquin Gil Lucas) #1

Hi! I'am new in logstash.
My example log:
30116102503C01 016405404007100
I want parse the next way:

30116102503C
01
0164054
04007
100

But, I've only managed to do this:

{
"tipo": [
"30116102503C"
],
"tipo2": [
"01"
],
"tipo3": [
"016405404007100"
]
}

With this:

%{USERNAME:tipo}%{NUMBER:tipo2}%{SPACE}%{SPACE}%{SPACE}%{SPACE}%{SPACE}%{NUMBER:tipo3}

I can not find the way to count characters and separate them

Thanks!


(Magnus B├Ąck) #2

Use {N} to match N occurrences of the preceding token, i.e. [A-Z0-9]{12} matches 12 letters and digits.


(Jose Joaquin Gil Lucas) #3

Thanks!


(system) #4

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