# Filter config fails

**URL:** <https://discuss.elastic.co/t/filter-config-fails/32028>\
**Category:** Logstash\
**Created:** [October 12, 2015, 6:20pm UTC](https://discuss.elastic.co/t/filter-config-fails/32028 "2015-10-12T18:20:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluethundr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bluethundr/32/409_2.png) [@bluethundr](https://discuss.elastic.co/u/bluethundr)\
**Post date:** [October 12, 2015, 6:20pm UTC](https://discuss.elastic.co/t/filter-config-fails/32028/1 "2015-10-12T18:20:07Z")

</div>

Hey guys,

Sorry if this is a little basic. But I wrote this filter and stashed it into it's own config file:

```
filter {
  if [type] == "syslog" {
   grok {
    match => { "message" => "\{", "%{QS}:%{BASE16FLOAT:timestamp}" + "," + "%{QS}:%{QS:SyslogDrainUrlsController}" + "," + "%{QS}:{QS:loglevel}" + "," + "%{QS}:{QS:source}" + "," + "%{QS}:{%{QS}:%{QS:request_guid}}" + "," + "%{QS}:{QS:thread_id}" + "," + "%{QS}:{QS:fiber_id}" + "%{QS}:{QS:process_id}" + "%{QS}:{QS:file}" + "," + "%{QS}:%{NUMBER:lineno}" + "," + "%{QS}:{QS:file}" + "\}" } ,
    add_tag => "cctl"
   }
 }
}

```

I'm very eager to try it out and see if it works. However it's failing a basic config test:

```
# /opt/logstash/bin/logstash --configtest --config 02-logstash-syslog.conf
Error: Expected one of #, {, } at line 4, column 33 (byte 79) after filter {
  if [type] == "syslog" {
   grok {
    match => { "message" => "\}"

```

Can anyone spot what's going wrong there? Bummer I'm not sure where the error is.

This is the log entry that I'm trying to match, in case anyone is interested:

```
{"timestamp":1444663721.004162,"message":"dispatch VCAP::CloudController::SyslogDrainUrlsController get /v2/syslog_drain_urls","log_level":"debug","source":"cc.api","data":{"request_guid":"0c0395a8-8d54-42dd-5cc7-f3b4a2c1fad9::78713c18-6a70-4872-9b19-37d629d68f09"},"thread_id":69959711038800,"fiber_id":69959731966880,"process_id":4819,"file":"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/rest_controller/routes.rb","lineno":12,"method":"block in define_route"}

```

Thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 12, 2015, 6:33pm UTC](https://discuss.elastic.co/t/filter-config-fails/32028/2 "2015-10-12T18:33:25Z")

</div>

Use the json filter or json codec to deserialize the message. Do not parse JSON with a grok filter.

(But the problem is that you're not escaping double quotes within a double-quoted string. Do that, or make the string single-quoted.)

---

<div class="post-metadata">

**Author:** ![bluethundr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bluethundr/32/409_2.png) [@bluethundr](https://discuss.elastic.co/u/bluethundr)\
**Post date:** [October 12, 2015, 7:30pm UTC](https://discuss.elastic.co/t/filter-config-fails/32028/3 "2015-10-12T19:30:53Z")

</div>

Thanks! I made everything single qupte and that worked. As far as passing the configtest is concerned.

But I'll give the json filter a try and see what kind of results I can get with that.

Thanks for your help!

---

<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:** [July 6, 2017, 5:26am UTC](https://discuss.elastic.co/t/filter-config-fails/32028/4 "2017-07-06T05:26:50Z")

</div>


