# Logstash Config File not running getting error: contains non-ascii characters but are not UTF-8 encoded

**URL:** <https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080>\
**Category:** Logstash\
**Created:** [March 6, 2023, 1:22pm UTC](https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080 "2023-03-06T13:22:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [March 6, 2023, 1:22pm UTC](https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080/1 "2023-03-06T13:22:05Z")

</div>

Hello All,

I'm getting below error while running the logstash config,Unable to understand how it can be resolved.Eearlier it worked by now giving error.

```auto
input {
  
  jdbc { 
	jdbc_connection_string => "jdbc:oracle:thin:@abc:1521/tcs"
	jdbc_user => "random"
	jdbc_password => "random"
    jdbc_driver_library => "../lib/ojdbc8-12.2.0.1.jar"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
	jdbc_paging_enabled => true
	last_run_metadata_path => "../config/lastrun-tcs-package-details.yml"
	schedule => "*/10 * * * * *"
	connection_retry_attempts => 5
	connection_retry_attempts_wait_time => 10
	statement=> "select PACKAGE_ID,PACKAGE_DATA, from_tz(CAST (CREATION_DATE AS TIMESTAMP), 'UTC') as CREATION_DATE, from_tz(CAST (LAST_MOD_DATE AS TIMESTAMP), 'UTC') as LAST_MOD_DATE from mytable where LAST_MOD_DATE >= SYS_EXTRACT_UTC(:sql_last_value)"
	type => "tcs-package-details"
  }
  
  
}
 filter {
  if [type] == "tcs-package-details" {
	json {source => "event_data"} 
		split {field => "event_data"}
		mutate {remove_field => ["event_data"]}
}   
}

output {
#stdout { codec => json_lines }
  if [type] == "tcs-package-details"{
	elasticsearch {
		hosts => "http://abc:9200"
		ilm_pattern => "{now/d}-000001"
		"doc_as_upsert" => true
		ilm_rollover_alias => "tcs-package-details"
		ilm_policy => "tcs-monitor--policy"
		"document_id" => "%{package_id}"
		
	}
  } 
	
  
}

ERROR:

```

[2023-03-06T13:51:43,478][ERROR][logstash.agent] An exception happened when converging configuration {:exception=\>RuntimeError, :message=\>"Could not fetch the configuration, message: The following config files contains non-ascii characters but are not UTF-8 encoded ["/P/fol/MIS/logstash/logstash-7.9.1/bin/tcs-sql-package.cfg"]", :backtrace=\>["/P/fol/MIS/logstash/logstash-7.9.1/logstash-core/lib/logstash/agent.rb:185:in `converge_state_and_update'", "/P/fol/MIS/logstash/logstash-7.9.1/logstash-core/lib/logstash/agent.rb:114:in `execute'", "/P/fol/MIS/logstash/logstash-7.9.1/logstash-core/lib/logstash/runner.rb:395:in `block in execute'", "/P/fol/MIS/logstash/logstash-7.9.1/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}

```auto

Any suggestion would be helpful.

Thanx
```

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 6, 2023, 1:37pm UTC](https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080/2 "2023-03-06T13:37:29Z")

</div>

> [@PRASHANT\_MEHTA](#):
>
> /P/fol/MIS/logstash/logstash-7.9.1/bin/tcs-sql-package.cfg

The configuration you shared is this one?

> [@PRASHANT\_MEHTA](#):
>
> Eearlier it worked by now giving error.

What changed? Something changed. What you use to edit this file? Maybe something added a hidden character to the file.

Do you have `dos2unix` in the system? If you have, try to run `dos2unix file` and see if it solves.

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [March 6, 2023, 2:24pm UTC](https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080/3 "2023-03-06T14:24:27Z")

</div>

Hello @leandrojmp ,

Thanx for having a look into this.I was able to resolve this by opening in notepad++.  
selecting encoding option-\>it was showing ANSI switched to UTF,after taht i could see some random values that might be mistakenly added.This resolved.

Many Thanx

---

<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:** [April 3, 2023, 2:25pm UTC](https://discuss.elastic.co/t/logstash-config-file-not-running-getting-error-contains-non-ascii-characters-but-are-not-utf-8-encoded/327080/4 "2023-04-03T14:25:15Z")

</div>

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