# Logstash-input-file scans non latin character file name cause InvalidPathException and stopped working

**URL:** <https://discuss.elastic.co/t/logstash-input-file-scans-non-latin-character-file-name-cause-invalidpathexception-and-stopped-working/301818>\
**Category:** Logstash\
**Created:** [April 7, 2022, 2:43am UTC](https://discuss.elastic.co/t/logstash-input-file-scans-non-latin-character-file-name-cause-invalidpathexception-and-stopped-working/301818 "2022-04-07T02:43:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lixplor](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@lixplor](https://discuss.elastic.co/u/lixplor)\
**Post date:** [April 7, 2022, 2:43am UTC](https://discuss.elastic.co/t/logstash-input-file-scans-non-latin-character-file-name-cause-invalidpathexception-and-stopped-working/301818/1 "2022-04-07T02:43:38Z")

</div>

Hi,

I'm using Logstash 6.8.23 with file input plugin 4.1.18 on a JRE 8 env. OS is suse11 and system default locale is zh\_CN.gbk.

When Logstash collecting logs, it reached a file with non-latin name. eg. 你好.xml. Then Logstash shows below errors in logstash-plain.log and stopped collecting:

```auto
[2022-04-01T01:00:00,00][ERROR][logstash.pipeline] A plugin had an unrecoverable error. Will restart this plugin.
  Pipeline_id:main
  Plugin: <LogStash::Inputs::File start_position=>"beginning", path=>... check_archive_validity=>false>
  Error: Malformed input or input contains unmappable characters: /home/user/???????.xml
  Exception: Java::JavaNioFile::InvalidPathException
  Stack: sun.nio.fs.UnixPath.encode(UnixPath.java:147)
  ...
[2022-04-01T01:00:00,00][INFO][filewatch.observingtail] QUIT - closing all files and shutting down.
[2022-04-01T01:00:00,00][INFO][filewatch.observingtail] QUIT - closing all files and shutting down.

```

I checked Logstash that it was running with `-Dfile.encoding=UTF-8`. But it seems cannot work with UTF-8 character file path.

This problem happens on Logstash 6.8.23. When I was using Logstash 6.0.0. There was no such error. So I think there're some encoding config I should make?

---

<div class="post-metadata">

**Author:** ![lixplor](https://avatars.discourse-cdn.com/v4/letter/l/bc79bd/32.png) [@lixplor](https://discuss.elastic.co/u/lixplor)\
**Post date:** [April 7, 2022, 3:37am UTC](https://discuss.elastic.co/t/logstash-input-file-scans-non-latin-character-file-name-cause-invalidpathexception-and-stopped-working/301818/2 "2022-04-07T03:37:14Z")

</div>

Hi guys,

I figured it out. The reason is surely system encoding does not support filename characters.  
To resolve it, you can ether change system encoding, or just add a jvm parameter `-Dsun.jnu.encoding=UTF-8`

---

<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:** [May 5, 2022, 3:37am UTC](https://discuss.elastic.co/t/logstash-input-file-scans-non-latin-character-file-name-cause-invalidpathexception-and-stopped-working/301818/3 "2022-05-05T03:37:40Z")

</div>

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