# Logstash Uknown error while parsing user agent data

**URL:** <https://discuss.elastic.co/t/logstash-uknown-error-while-parsing-user-agent-data/185334>\
**Category:** Logstash\
**Created:** [June 12, 2019, 6:27am UTC](https://discuss.elastic.co/t/logstash-uknown-error-while-parsing-user-agent-data/185334 "2019-06-12T06:27:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElkNovice](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@ElkNovice](https://discuss.elastic.co/u/ElkNovice)\
**Post date:** [June 12, 2019, 6:27am UTC](https://discuss.elastic.co/t/logstash-uknown-error-while-parsing-user-agent-data/185334/1 "2019-06-12T06:27:59Z")

</div>

Using logstash 7.1, in logs I repeated see the below mentioned error messages. What can I do to get more information on the reason of these errors? Also, if it is known problem, can you guide on what could be the issue here?

I tried adding below lines in log4j2.properties and restarting logstash, but no new logs were generated.

**log4j2.properties**  
logger.useragent.name = logstash.filters.useragent  
logger.useragent.level = debug

**Error Messages**  
[2019-06-11T13:54:10,836][ERROR][logstash.filters.useragent] Uknown error while parsing user agent data {:exception=\>#\<TypeError: cannot convert instance of class org.jruby.RubyHash to class java.lang.String\>, :field=\>"agent", :event=\>#LogStash::Event:0x251fc06e}  
[2019-06-11T13:54:10,836][ERROR][logstash.filters.useragent] Uknown error while parsing user agent data {:exception=\>#\<TypeError: cannot convert instance of class org.jruby.RubyHash to class java.lang.String\>, :field=\>"agent", :event=\>#LogStash::Event:0x54d0c346}  
[2019-06-11T13:54:10,836][ERROR][logstash.filters.useragent] Uknown error while parsing user agent data {:exception=\>#\<TypeError: cannot convert instance of class org.jruby.RubyHash to class java.lang.String\>, :field=\>"agent", :event=\>#LogStash::Event:0x397a8814}  
[2019-06-11T13:54:10,837][ERROR][logstash.filters.useragent] Uknown error while parsing user agent data {:exception=\>#\<TypeError: cannot convert instance of class org.jruby.RubyHash to class java.lang.String\>, :field=\>"agent", :event=\>#LogStash::Event:0x5a69d23}

---

<div class="post-metadata">

**Author:** ![ElkNovice](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@ElkNovice](https://discuss.elastic.co/u/ElkNovice)\
**Post date:** [June 28, 2019, 1:12pm UTC](https://discuss.elastic.co/t/logstash-uknown-error-while-parsing-user-agent-data/185334/2 "2019-06-28T13:12:49Z")

</div>

The issue was in the logstash filter for access logs, I was parsing the log content related to user agent and saving it in a field named "agent" and was using useragent plugin on this agent field. In 7.x version "agent" seems to be an internal field used by beats. So, I changed the name to "user\_agent" and used that in useragent plugin. Changing the name resolved the error.

---

<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 26, 2019, 1:12pm UTC](https://discuss.elastic.co/t/logstash-uknown-error-while-parsing-user-agent-data/185334/3 "2019-07-26T13:12:49Z")

</div>

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