-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input crashes on TZInfo::AmbiguousTime Error when setting jdbc_default_timezone #121
Comments
Hi! I am having the same error:
It is quite a problem that this is causing logstash to restart endlessly. |
As far as I understand the issue logstash-input-jdbc would have to let us configure (like tzinfo does it) what fallback (pick first or second point in time) to perform in case of an ambigous time stamp. As long as it doesn't to this it's somewhat "correct" to fail fatally. Here is my understanding of the whole thing - please correct me if I'm wrong:
I know - that's all evil stuff and everyone should only write UTC timestamps to avoid such awkwardness but in reality there are a lot of databases out there logging stuff in local timezones that support daylight saving time shifts - so support for that would be great :-) |
I totally agree with you (timezones are just so annoying to handle). Probably the |
Good point - I don't know either. If one of the contributors of this plugin could confirm or negate that we could keep this ticket here or move it to the proper elastic project instead. I guess in the end there should be a global or plugin specific setting, leading to these calls:
as mentioned in the linked tzinfo issue. |
I have the same issue here. I am importing data from a database with local timestamps. Even handling the exception and returning a _dateparsefailure in logstash would help. Then we could redirect the output to a file an parse accordingly. |
Coming back to this issue, I think that the problem comes from the As you can see here: There is an attribute If I could send a PR I would, but I am really unfamiliar with ruby language so I hope this will help to fix this issue. |
Any update or workaround for this? My import job is now stuck with this error... |
we are using the following workaround to convert CET dates without timezone to UTC in the SQL statement (running against oracle database): select from_tz(cast(<column> as timestamp), 'CET') at time zone ('UTC') "@timestamp"
from <table>
where ... then ensure that timezone setting of the local machine or "jdbc_default_timezone" is UTC maybe something similar is possible with MySQL? |
Unfortunately, the setting linked for supplying a In a brief spike, I have created a timezone proxy object using # Quacks like a Timezone
class TimezoneWrapper < SimpleDelegator
##
# Wraps a ruby timezone object in an object that has an explicit preference in time conversions
# either for or against having DST enabled.
#
# @param timezone [String,TZInfo::Timezone]
# @param dst_enabled_on_overlap [Boolean] (default: nil) when encountering an ambiguous time,
# declare a preference for selecting the option with DST either enabled or disabled.
def self.wrap(timezone, dst_enabled_on_overlap)
timezone = TZInfo::Timezone.get(timezone) if timezone.kind_of?(String)
new(timezone, dst_enabled_on_overlap)
end
##
# @api private
def initialize(timezone, dst_enabled_on_overlap)
super(timezone) # SimpleDelegator
@dst_enabled_on_overlap = dst_enabled_on_overlap
end
##
# @override `Timezone#period_for_local`
# inject an implicit preference for DST being either enabled or disabled if called
# without an explicit preference
def period_for_local(value, dst_enabled_on_overlap=nil, &global_disambiguator)
dst_enabled_on_overlap = @dst_enabled_on_overlap if dst_enabled_on_overlap.nil?
__getobj__.period_for_local(value, dst_enabled_on_overlap, &global_disambiguator)
end
end In this way, we could set the if @jdbc_default_timezone
@database.timezone = TimezoneWrapper.wrap(@jdbc_default_timezone, @jdbc_default_timezone_dst_enabled_on_overlap)
end A couple open questions:
(cc: @guyboertje @jakelandis) |
I agree with @mbertani: Would help a lot just to get a proper exception and a _dateparsefailure or something similar. Now, logstash silently crashes and drops events. Took me a long time to figure out what was going on. |
I don't really understand why this is not labeled as a bug. If I understand this correctly, the jdbc_default_timezone cannot be used in countries using daylight saving time. |
@marbin As @yaauie points out, the setting that is made available for us to change in Sequel (the 3rd party ORM) that we use, is a global setting meaning that all jdbc inputs, jdbc_streaming and jdbc_static filters in a LS instance (across all pipelines) will have the same disambiguation set. Due to this global effect, setting a timezone in one plugin affects all plugins. Unfortunately, either way the disambiguation proc chooses (first or last) will create some timestamps that overlap - there is no way to avoid this. |
@guyboertje You mean that just because the bug only occurs in timezones with daylight savings, i.e. all of Europe, US, Australia etc and just once a year, it is not a bug ;-) Joking aside, In my case, we had several pipelines that just crashed and it was pretty tricky to figure out what was going on, since there were no error messages in the logs. Had to turn on debugging to find it. I understand this is a hard one to fix, but I think it would make sense to track it as a bug and maybe a warning in the docs for the jdbc_default_timezone feature, since using it with a timezone with daylight saving WILL crash your pipeline. |
@marbin We do have plans to switch all our jdbc plugins to a common reusable Java framework based around HikariCP, Vanilla JDBC and Quartz but this is a lot of work but we feel there are many niggling faults with the current code across all jdbc plugins that warrant the effort. Therefore, fixing these issues and having the current set of tests pass is the goal of the move to Java project. |
This "bug" doesn't only happen if you have data with a date in this 1 hour interval, it also does it you have a job that runs in that hour using a datefield as the index column. If this happens, then an ambiguous date is stored in the meta file and that job will fail until you manually change / clear that meta file. |
I am having this issue now. Any changes? Any other workarounds? |
Same for me. Any update on this ? |
…3+00:00 is an ambiguous local time See related issues : - logstash-plugins/logstash-input-jdbc#121 - tzinfo/tzinfo#32
hello, any news ? |
Same here. any workaround example for mysql 5.5? |
Hello new hit on that bug tonight, no progress on the AmbiguousTime problem ? |
Problem occurs here as well, no logs are loaded since hour change, whats the progress on this issue? |
I have encountered the same issue, any news on when this is going to be resolved? |
As long as jdbc crashes on this, for MySQL, you can try to avoid the issue like this : (You'll need to populate tz infos of your mysql db first if it's not already the case with : CONVERT_TZ should handle properly this annoying AmbiguousTime Error |
Any updates on this? Unfortunately it's currently not really feasible for us to convert everything to UTC. |
Since v5.4.0 of this plugin (which is now distributed as a part of the JDBC Integration plugin for Logstash), you can specify the behaviour when encountering an ambiguous timestamp:
Versions of this plugin with this feature were first shipped with Logstash v8.6.0. Logstash 7.6+ and 8.0+ shipped with the JDBC Integration plugin, so it can be updated with the normal method:
Logstash < 7.5 will need to remove the stand-alone JDBC plugins prior to installing the integration plugin, which will look something like:
|
@yaauie Thank you so much. That helps a lot, unfortunately because of another issue in Elasticsearch itself, we cannot upgrade to Logstash 8.6.0 just now, but as you pointed out, I can just upgrade the integration-plugin in Logstash 8.3.3 |
Hi there! First of all - thanks a lot for this plugin - it's great!
However, when using my MySQL DB's timestamp in elasticsearch/kibana I noticed it was off by 1h since the MySQL timestamp is interpreted as UTC but in fact is CET.
So i added:
jdbc_default_timezone => "Europe/Berlin"
But now my logstash-pipeline crashes fatal resulting in an endless loop of trying to read data from MySQL with this error:
I'm aware that this might probably more like an tzinfo related problem (tzinfo/tzinfo#32) but I don't see any other possibility to make it work correctly.
Exporting a UNIX-timestamp in MySQL and using a date input filter combined with the "unix" timestamp parser is (for whatever reason) painfully slow resulting in jammed elasticsearch input queues.
Best - Max
The text was updated successfully, but these errors were encountered: