# Logstash Grok Path "\\" character

**URL:** <https://discuss.elastic.co/t/logstash-grok-path-character/326083>\
**Category:** Logstash\
**Created:** [February 21, 2023, 2:55pm UTC](https://discuss.elastic.co/t/logstash-grok-path-character/326083 "2023-02-21T14:55:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GinkoLucas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginkolucas/32/107055_2.png) [@GinkoLucas](https://discuss.elastic.co/u/GinkoLucas)\
**Post date:** [February 21, 2023, 2:55pm UTC](https://discuss.elastic.co/t/logstash-grok-path-character/326083/1 "2023-02-21T14:55:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 21, 2023, 3:03pm UTC](https://discuss.elastic.co/t/logstash-grok-path-character/326083/2 "2023-02-21T15:03:42Z")

</div>

You should use this:

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

```

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 21, 2023, 3:04pm UTC](https://discuss.elastic.co/t/logstash-grok-path-character/326083/3 "2023-03-21T15:04:34Z")

</div>

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