# Encoding in logstash configure file and there must be space before end of Exec plugin argument

**URL:** <https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228>\
**Category:** Logstash\
**Created:** [October 15, 2015, 2:58am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228 "2015-10-15T02:58:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShinJJang](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@ShinJJang](https://discuss.elastic.co/u/ShinJJang)\
**Post date:** [October 15, 2015, 2:58am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/1 "2015-10-15T02:58:26Z")

</div>

Hi there,

I have problem using korean(utf-8) arguments in exec output.

```
output {
    command => "test.sh '' '{한글과 English}' 'somthing' " # If there is not end space '(single quote) with "(double quote), error occur!
}

```

Test command do echo variables.  
Result is "var1 = {??? English}, var2 = something"

Korean(utf-8) is represented by ?(question mark).

There must be space before end of Exec plugin argument.  
If there is not end space '(single quote) with "(double quote), error occur!

```
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file is there
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 15, 2015, 3:26am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/2 "2015-10-15T03:26:25Z")

</div>

It looks like this is a problem with your script, not with Logstash?

---

<div class="post-metadata">

**Author:** ![ShinJJang](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@ShinJJang](https://discuss.elastic.co/u/ShinJJang)\
**Post date:** [October 15, 2015, 4:20am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/3 "2015-10-15T04:20:44Z")

</div>

When I run shell script itself, error not occur.  
Below both example work.

```
$ /etc/logstash/test.sh '한글(utf-8)' 'blah blah'

# without space between ' and "
$ eval "/etc/logstash/test.sh '한글(utf-8)' 'blah blah'" 

```

**And is there method to represent utf-8 character in logstash configuration file?**

When I send to plugin, not problem. But in exec plugin, argument is presented through logstash.

---

<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 15, 2015, 5:53am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/4 "2015-10-15T05:53:01Z")

</div>

I can't reproduce either of the reported problems.

```
$ cat test.config 
input {
  exec {
    command => "echo '한글과 foo'"
    interval => 2
  }
}
output { stdout { codec => rubydebug } }
$ /opt/logstash/bin/logstash -f test.config
Logstash startup completed
{
       "message" => "한글과 foo\n",
      "@version" => "1",
    "@timestamp" => "2015-10-15T05:50:45.014Z",
          "host" => "lnxolofon",
       "command" => "echo '한글과 foo'"
}
^CSIGINT received. Shutting down the pipeline. {:level=>:warn}
Logstash shutdown completed
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
```

---

<div class="post-metadata">

**Author:** ![ShinJJang](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@ShinJJang](https://discuss.elastic.co/u/ShinJJang)\
**Post date:** [October 15, 2015, 5:57am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/5 "2015-10-15T05:57:59Z")

</div>

**Plugin to Plugin** is not problem.

What I do is express UTF-8 string **in configure file.**

like

```
output {
  exec {
    command => "echo '한글과 foo'"
  }
} 

```

check out this.

---

<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 15, 2015, 6:15am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/6 "2015-10-15T06:15:49Z")

</div>

Still not able to reproduce.

```
$ cat test.config 
input { stdin { } }
output {
  exec {
    command => "echo '한글과 foo'"
  }
}
$ echo some input | /opt/logstash/bin/logstash -f test.config
Logstash startup completed
한글과 foo
Logstash shutdown completed
```

---

<div class="post-metadata">

**Author:** ![ShinJJang](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@ShinJJang](https://discuss.elastic.co/u/ShinJJang)\
**Post date:** [October 15, 2015, 6:24am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/7 "2015-10-15T06:24:19Z")

</div>

Hmm...

```
$ cat conf.d/test.conf
# test
input { stdin { } }
output {
  exec {
    command => "echo '한글과 foo'"
  }
}

$ tail /var/log/logstash/logstash.stdout
??? foo
??? foo

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

```

I have no idea. maybe problem is adaptive to system.  
CentOS release 6.7 (Final), logstash-1.5.4-1.noarch

---

<div class="post-metadata">

**Author:** ![ShinJJang](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@ShinJJang](https://discuss.elastic.co/u/ShinJJang)\
**Post date:** [October 16, 2015, 1:49am UTC](https://discuss.elastic.co/t/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/8 "2015-10-16T01:49:28Z")

</div>

@magnusbaeck I found this problem reproduced, when left as .stdout file!  
I also work, when I start as a binary file.

I set up with rpm and run service. so /var/log/logstash/logstash.stdout is point to check.

---

<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/encoding-in-logstash-configure-file-and-there-must-be-space-before-end-of-exec-plugin-argument/32228/9 "2017-07-06T05:26:20Z")

</div>


