# Dissect with a backslash at the end of the log line

**URL:** https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630
**Category:** Logstash
**Created:** [January 27, 2020, 10:14am UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630 "2020-01-27T10:14:07Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Vincent\_Maury](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent_maury/32/59973_2.png) [@Vincent\_Maury](https://discuss.elastic.co/u/Vincent_Maury)
#### Post date: [January 27, 2020, 10:14am UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/1 "2020-01-27T10:14:07Z")

</div>

Hi,  
I'm having a log (from EMC Celerra) that ends with a backslash like this:  
`<event_source>:<severity>:<id> daemon \`

I'm trying this dissect:  
dissect {  
mapping =\> { "message" =\> "%{event\_source}:%{severity}:%{id} daemon \" }  
}  
but it won't work.  
The \ anywhere in the string does work, but at the end it's considered to be escaping the " I guess.  
And a double \\ won't work either.

How should I proceed?  
Thanks a lot in advance for your help!

Vincent

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [January 27, 2020, 2:39pm UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/2 "2020-01-27T14:39:39Z")

</div>

Take a look at [this](https://github.com/elastic/logstash/issues/9701) issue, which I think applies to strings in general, not just regexps. The workaround is setting config.support\_escapes

---

<div class="post-metadata">

### Author: ![Vincent\_Maury](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent_maury/32/59973_2.png) [@Vincent\_Maury](https://discuss.elastic.co/u/Vincent_Maury)
#### Post date: [January 27, 2020, 4:51pm UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/3 "2020-01-27T16:51:23Z")

</div>

Thank you @Badger  
I enabled this setting, although i didn't read the scope of it (does it apply to the input-generator-message field? to the filter-dissect-mapping string?)  
it's working when i set \\ in the middle of the string, but i'm still not able to test it at the end of the string.  
See my test config:

```
input {
	generator {
		count => 1
		message => "Bla %stuff \"January\", 15 2019 ['83.202.178.93'] and just testing spaces before an anchor and others after plus all the end\\"
	}
}

filter {
	dissect {
		mapping => { "message" => "Bla %stuff \"%{month}\", %{day} %{year} ['%{devicehostip}'] and %{fld} an anchor and %{fld2} plus %{message}\\" }
	}
}

output {
  stdout {
    codec => rubydebug
  }
}
```

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [January 27, 2020, 5:46pm UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/4 "2020-01-27T17:46:05Z")

</div>

It should apply to the whole configuration. I agree that it does not seem to help here. Time for an ugly hack

```
mutate { gsub => ["message", "$", " "] }

```

Then add a space after the \ in your dissect mapping 😃

---

<div class="post-metadata">

### Author: ![Vincent\_Maury](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent_maury/32/59973_2.png) [@Vincent\_Maury](https://discuss.elastic.co/u/Vincent_Maury)
#### Post date: [January 31, 2020, 10:47am UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/5 "2020-01-31T10:47:55Z")

</div>

Thanks @Badger  
It's a quick hack indeed!  
I hope this issue will be fixed soon 😉

---

<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: [February 28, 2020, 10:47am UTC](https://discuss.elastic.co/t/dissect-with-a-backslash-at-the-end-of-the-log-line/216630/6 "2020-02-28T10:47:56Z")

</div>

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