# Unexpected character '\<'

**URL:** <https://discuss.elastic.co/t/unexpected-character/170366>\
**Category:** Logstash\
**Created:** [February 28, 2019, 3:00pm UTC](https://discuss.elastic.co/t/unexpected-character/170366 "2019-02-28T15:00:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![colix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colix/32/46274_2.png) [@colix](https://discuss.elastic.co/u/colix)\
**Post date:** [February 28, 2019, 3:00pm UTC](https://discuss.elastic.co/t/unexpected-character/170366/1 "2019-02-28T15:00:15Z")

</div>

Hi, i sent json log to logstash.

**Logstash config:**

```
input {
udp {
port => 5001
codec => "json"
}
}

filter {
     json {
     source => "message"
}
}

output {
if [type] == "rsyslog" {
elasticsearch {
hosts => ["elasticsearch:9200"]
}
}
} 

```

But log on logstash container deliver with bad prefix - **\<190\>1** and etc.

I can't parse json log.

How i can remove this prefix?

```
   2019-02-28T14:48:05.337654192Z [2019-02-28T14:48:05,337][ERROR][logstash.codecs.json] JSON parse error, original data now in message field {:error=>#<LogStash::Json::ParserError: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
    2019-02-28T14:48:05.337685673Z at [Source: (String)"<190>1 2019-02-28T17:47:58+03:00 rnis-fpo-t1sync-2 php-t1sync 1021 - - {"message":"Register service [com.rnis.t1sync] with subjects","context":[["com.rnis.t1sync.action.history","com.rnis.t1sync.action.mileage","com.rnis.t1sync.action.odometr","com.rnis.t1sync.action.motohours","com.rnis.t1sync.action.odometr.multiple","com.rnis.t1sync.action.history.multiple","com.rnis.t1sync.action.device.find","com.rnis.t1sync.action.device.score","com.rnis.t1sync.action.device.tachograph","com.rnis.t1sync.ac"[truncated 403 chars]; line: 1, column: 2]>, :data=>"<190>1 2019-02-28T17:47:58+03:00 rnis-fpo-t1sync-2 php-t1sync 1021 - - {\"message\":\"Register service [com.rnis.t1sync] with subjects\",\"context\":[[\"com.rnis.t1sync.action.history\",\"com.rnis.t1sync.action.mileage\",\"com.rnis.t1sync.action.odometr\",\"com.rnis.t1sync.action.motohours\",\"com.rnis.t1sync.action.odometr.multiple\",\"com.rnis.t1sync.action.history.multiple\",\"com.rnis.t1sync.action.device.find\",\"com.rnis.t1sync.action.device.score\",\"com.rnis.t1sync.action.device.tachograph\",\"com.rnis.t1sync.action.extended_data\",\"com.rnis.t1sync.action.device.arhived_telematics\",\"com.rnis.system.event.status.collect\"]],\"level\":200,\"level_name\":\"INFO\",\"channel\":\"lumen\",\"datetime\":{\"date\":\"2019-02-28 17:47:58.960518\",\"timezone_type\":3,\"timezone\":\"Europe/Moscow\"},\"extra\":[],\"timestamp\":\"2019-02-28T17:47:58.960518+0300\",\"service\":\"t1sync\",\"env\":\"production\",\"hostname\":\"rnis-fpo-t1sync-2\",\"ip\":\"10.42.88.188\"}\n"
```

---

<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:** [February 28, 2019, 3:23pm UTC](https://discuss.elastic.co/t/unexpected-character/170366/2 "2019-02-28T15:23:48Z")

</div>

You should not have both a json codec and a json filter. In this case you need to use a json filter.

```
    dissect { mapping => { "message" => "<%{pri}>%{item1} %{ts} %{hostname} %{item2} %{item3} - - %{restOfLine}" } }
    json { source => "restOfLine" }
```

---

<div class="post-metadata">

**Author:** ![colix](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colix/32/46274_2.png) [@colix](https://discuss.elastic.co/u/colix)\
**Post date:** [February 28, 2019, 8:00pm UTC](https://discuss.elastic.co/t/unexpected-character/170366/3 "2019-02-28T20:00:15Z")

</div>

Even if i don't use json filter i have bad prefix

---

<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 28, 2019, 8:00pm UTC](https://discuss.elastic.co/t/unexpected-character/170366/4 "2019-03-28T20:00:17Z")

</div>

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