Skip to content
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

Set database date data timezone #89

Closed
razafinr opened this issue Nov 26, 2015 · 5 comments
Closed

Set database date data timezone #89

razafinr opened this issue Nov 26, 2015 · 5 comments
Assignees
Labels

Comments

@razafinr
Copy link

I am using the logstash jdbc-input plugin to import data from my database to Elasticsearch.

In the old jdbc river, I think that it was possible to set the timezone used by the database for date data. Is it possible to set it with the logstash jdbc plugin ?

For the moment the dates in my database are in UTC but the jdbc-plugin use the local timezone of my machine when exporting them and tries to convert it again in UTC so all my dates are wrong.

@razafinr
Copy link
Author

The workaround of my issue is to convert all dates to VARCHAR when getting them from database.

Then it is possible to apply a date filter on EACH of them. I can not apply directly the date filter without converting the dates to VARCHAR because the dates are retrieved as Ruby date object by the jdbc input so they can not be filtered directly.

This seems really painful as solution, as we can just have a parameter for the jdbc input to specify the timezone of the database dates.

@suyograo
Copy link
Contributor

suyograo commented Dec 6, 2015

@razafinr #83 added support to convert to Logstash::Timestamp from Ruby timestamp. we should fix the UTC aspect

@untergeek
Copy link
Contributor

Closed by #95

@razafinr
Copy link
Author

razafinr commented Dec 9, 2015

Thank you for the fix.

I think there is one dependency missing (I am totally new to Ruby): tzinfo-data.

When I tried to run the master branch after installing it, I got this issue: TZInfo::DataSourceNotFound

The solution was then referred here: https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors

I added tzinfo-data to the gemspec and reinstalled the plugin and it worked like charm.

@untergeek
Copy link
Contributor

Fascinating. I wonder why it even worked for me and the testing infrastructure, without specifying it in the Gemspec.

Please open this as a new issue and we'll add it in so it is guaranteed to be there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants