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

Custom time format issue #616

Open
ochanism opened this issue Jul 6, 2016 · 1 comment
Open

Custom time format issue #616

ochanism opened this issue Jul 6, 2016 · 1 comment

Comments

@ochanism
Copy link

ochanism commented Jul 6, 2016

I am using a time format [ yyyy-MM-dd HH:mm:ss.SSS ] for elasticsearch data.
Thus, I tried to configure time format with custom type like this.

timestamp_field: timestamp
timestamp_type: custom
timestamp_format: "%Y-%m-%d %H:%M:%S.%f"

But, %f is for microsecond, not millisecond.
So I got this error.

[{u'reason': u'failed to parse date field [2016-07-04 02:27:56.274273] with format [yyyy-MM-dd HH:mm:ss.SSS]', u'type': u'parse_exception'}]

Is there any way to configure custom time format for millisecond?

@Qmando
Copy link
Member

Qmando commented Jul 6, 2016

Unfortunately, Python doesn't support millisecond-only accurate with strftime.

I have not really tested this, but as a temporary fix, you can try replacing this line (

return ts
) with return ts[:-3]
That should make it cut off the last 3 digits of the timestamp.

Going the other way, python will accept .274 or .274000 milliseconds as equivalent, so that should be ok.

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

No branches or pull requests

2 participants