Logstash Grok Path "\" character

Hello,

I have a problem that seems simple to solve, but I'm having trouble solving it.

I have to grok a path, here is a path similar to mine:

D:\MyFiles\allmylogs.log

I have a problem with the "\".

How can I include it in my grok? :

\\ ?
[\\] ?
\ ?

I'm trying to doing this :
%{DATA:letter}:\%{DATA:Directory}\%{DATA:fileName}.log

I'm sure it's just silly.

Thx for your help

You should use this:

%{DATA:letter}:\\%{DATA:Directory}\\%{DATA:fileName}\.log

You use \ to escape the backslash and you also need to escape the dot before log.

2 Likes

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