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

removed FLBTime because uint64 interface cannot be converted to int64 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guineveresaenger
Copy link

The code as written cannot be converted into FLBTime. Unix time is consistently displayed in the Time field across plugins; perhaps this is an issue that can be addressed in fluent-bit code base?

Disclaimer: I'm a novice at golang and would be more than happy to learn about a different way to re-type the time and display it as human readable.

@majst01
Copy link

majst01 commented Feb 20, 2018

@guineveresaenger I faced the same issue, and i added the following code to prevent crashes:

var timeStamp string
switch t := ts.(type) {
case output.FLBTime:
	timeStamp = ts.(output.FLBTime).String()
case uint64:
	timeStamp = time.Unix(int64(t), 0).Format(timeFormat)
default:
	fmt.Print("given time is not in a known format, defaulting to now.\n")
	timeStamp = time.Now().Format(timeFormat)
}

See: https://github.com/majst01/fluent-bit-go-redis-output/blob/master/out_redis.go#L84

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

Successfully merging this pull request may close these issues.

2 participants