# Cannot determine timezone from nil logstash

**URL:** https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217
**Category:** Logstash
**Created:** [November 15, 2023, 10:40am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217 "2023-11-15T10:40:51Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![SamehSaeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samehsaeed/32/145262_2.png) [@SamehSaeed](https://discuss.elastic.co/u/SamehSaeed)
#### Post date: [November 15, 2023, 10:40am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/1 "2023-11-15T10:40:51Z")

</div>

I'm getting an error while running logstash

" (ArgumentError) Cannot determine timezone from nil\n(secs:1700041898.446,utc~:"2023-11-15 09:51:38.4460000991821289",ltz~:nil)"

I have tried solutions from other threads (adding jdbc\_default\_timezone =\> "Asia/Riyadh" to logstash .conf file or adding TZ="Asia/Riyadh" to elasticsearch.yaml file) but still didnt work for me .

The only solution to get around this was to change the timezone of the server itself to UTC (this was only temporary till i have better understanding of the ELK stack). Is there another solution to this?

ELK stack version 8.10.2

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [November 15, 2023, 11:28pm UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/2 "2023-11-15T23:28:11Z")

</div>

Welcome to the community!  
The field has the value: "2023-11-15 09:51:38.4460000991821289", how did you try conversion? Pls copy the date {} code.

---

<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: [November 15, 2023, 11:43pm UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/3 "2023-11-15T23:43:57Z")

</div>

> [@SamehSaeed](#):
>
> I have tried solutions from other threads (adding jdbc\_default\_timezone =\> "Asia/Riyadh" to logstash .conf file or adding TZ="Asia/Riyadh" to elasticsearch.yaml file) but still didnt work for me .

I am surprised that setting jdbc\_default\_timezone did not fix it, but setting `TZ="Asia/Riyadh"` would need to be done in the shell script that invokes logstash (and you might need `export TZ="Asia/Riyadh"`. Definitely not in elasticsearch.yaml which logstash does not use.

---

<div class="post-metadata">

### Author: ![SamehSaeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samehsaeed/32/145262_2.png) [@SamehSaeed](https://discuss.elastic.co/u/SamehSaeed)
#### Post date: [November 16, 2023, 7:12am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/4 "2023-11-16T07:12:49Z")

</div>

Thank you, here is my pipeline configuration :

```auto
input {
    jdbc {
	 clean_run => true
        jdbc_driver_library => "E:\ELK 8.10.2\logstash-conf\ojdbc6.jar"
        jdbc_driver_class => "oracle.jdbc.driver.OracleDriver"
        jdbc_connection_string => " *****"
        jdbc_user => " ****"
		jdbc_password => " ****"
		jdbc_default_timezone => "Asia/Riyadh"
        #schedule => "*/5 * * * *"
        statement => "SELECT CHANNEL FROM CALL_HISTORY_DETAILS_VIEW FETCH FIRST ROW ONLY"
        #use_column_value => true
		#tracking_column => "CALLS"
		tags => ["oraclelogger"]
    }
}
filter {
date {
      match => ["CALL_STRAT_DATE_TIME", "yyyy/MM/dd HH:mm:ss"] 
      timezone => "Asia/Riyadh"
      target=> "@timestamp" 
 }
}
output{
    elasticsearch {	
        hosts => ["http:// **** :9200/"]
		index => "testlogger_index"
		user => "elastic"
		password => " ****"
		ssl => false
		ssl_certificate_verification => false
    }
   
}

```

I have also tried converting @timestamp itself to a new field (through filter) but it didnt work, tried different format also (UNIX/ISO) still not getting any results.  
Tried selecting time column from DB with TO\_CHAR function and converted to the format 'yyyy/MM/dd HH:mm:ss', tried converting UTC

```auto
CAST(
    FROM_TZ(Call_Start_Time, 'Asia/Riyadh') AT TIME ZONE 'UTC' AS TIMESTAMP
  ) AS Call_Start_Time_UTC

```

This is getting really frustrating tbh ☹

---

<div class="post-metadata">

### Author: ![SamehSaeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samehsaeed/32/145262_2.png) [@SamehSaeed](https://discuss.elastic.co/u/SamehSaeed)
#### Post date: [November 16, 2023, 7:14am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/5 "2023-11-16T07:14:40Z")

</div>

Me too, everyone is complaining about data being stored with time offset due to different timezones, while its not even working for me.  
Also i would like to thank you for your replies to other threads, it helped me alot 🙂

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [November 16, 2023, 8:04am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/6 "2023-11-16T08:04:15Z")

</div>

Ah sorry, Badger has right and point to the right direction. There is [a bug](https://github.com/elastic/logstash/issues/14841).

Since you are on Win, you can use: `tzutil`

Or you can try with Pshell:

1. Get-TimeZone
2. Get-TimeZone -ListAvailable
3. Set-TimeZone -Name “Arab Standard Time” for Kuwait and Riyadh UTC+3

Since I hadn't this issue, if still not work , ELK is more Linux env, maaaybe try to set environment system variable TZ.

---

<div class="post-metadata">

### Author: ![SamehSaeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samehsaeed/32/145262_2.png) [@SamehSaeed](https://discuss.elastic.co/u/SamehSaeed)
#### Post date: [November 16, 2023, 8:24am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/7 "2023-11-16T08:24:46Z")

</div>

Timezone is already set to "(UTC+03:00) Kuwait, Riyadh",  
I have tried setting ENV variable TZ with value Asia/Riyadh (correct me if it's wrong). Still same issue.  
I think the problem is that logstash is trying to extract the default @timestamp UTC time from server timezone since it works perfectly fine when the server timezone is UTC.

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [November 16, 2023, 8:29am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/8 "2023-11-16T08:29:03Z")

</div>

Not sure where is an issue.

Since you have set jdbc\_default\_timezone, last try is to set [plugin\_timezone](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-plugin_timezone).

Badger if plugin\_timezone dosen't help, what do you thing, will `log.level: trace` lead to somethere?

---

<div class="post-metadata">

### Author: ![SamehSaeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samehsaeed/32/145262_2.png) [@SamehSaeed](https://discuss.elastic.co/u/SamehSaeed)
#### Post date: [November 16, 2023, 11:09am UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/9 "2023-11-16T11:09:04Z")

</div>

Thanks alot @Rios, I have recreated the TZ variable and restarted the server and it worked. Later I changed the timezone from Kibana settings (on browser) and now everything is working fine. Really appreciate this 😃

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [November 16, 2023, 12:27pm UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/10 "2023-11-16T12:27:06Z")

</div>

Thank you for feedback, really appreciate. It's important for the community.

ELK is nice, you have to understand how things works. Someone will help you even s/he didn't have similar problem. Elastic 🥰

---

<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: [December 14, 2023, 12:27pm UTC](https://discuss.elastic.co/t/cannot-determine-timezone-from-nil-logstash/347217/11 "2023-12-14T12:27:19Z")

</div>

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