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

Firehose & Kinesis Output plugin: time_key does not have milliseconds. #2831

Closed
taisyo7333 opened this issue Dec 4, 2020 · 13 comments
Closed
Assignees
Labels
AWS Issues with AWS plugins or experienced by users running on AWS enhancement

Comments

@taisyo7333
Copy link

taisyo7333 commented Dec 4, 2020

Bug Report

Describe the bug

When I use firehose output plugin.
time_key does not have milliseconds , only seconds resolution.
time_key records is like the below.

 "@timestamp":"2020-12-04T06:16:04"

To Reproduce

  • Rubular link if applicable:
  • Example log message if applicable:
  • Steps to reproduce the problem:
  1. Provision Kinesis firehose and S3 bucket.
  2. I use the follwing output config.
  3. firehose forwards data to S3 bucket.
  4. you can check logs in your S3 bucket.
[OUTPUT]
        Name             kinesis_firehose
        Match            *
        region           ${FLUENT_FIREHOSE_REGION}
        delivery_stream  ${FLUENT_FIREHOSE_DELIVERY_STREAM_NAME}
        time_key         @timestamp

Expected behavior

The time_key should have milliseconds resolution.

"@timestamp":"2020-12-04T06:16:04.789"

Screenshots

Your Environment

  • Version used: v1.6.8
  • Configuration:
[OUTPUT]
        Name             kinesis_firehose
        Match            *
        region           ${FLUENT_FIREHOSE_REGION}
        delivery_stream  ${FLUENT_FIREHOSE_DELIVERY_STREAM_NAME}
        time_key         @timestamp
  • Environment name and version (e.g. Kubernetes? What version?):
    • kubernetes
      • Amazon EKS
      • v1.18.9-eks-d1db3
  • Server type and version:
  • Operating System and version:
    • Amazon Linux 2
  • Filters and plugins:
    • Output kinesis_firehose plugin.

Additional context

we use firehose as logging architecture.

I think struct tm does not support milliseconds resolution.
This code uses struct tm.

https://github.com/fluent/fluent-bit/blob/master/plugins/out_kinesis_firehose/firehose_api.c#L233

@PettitWesley PettitWesley self-assigned this Dec 4, 2020
@PettitWesley PettitWesley added the AWS Issues with AWS plugins or experienced by users running on AWS label Dec 4, 2020
@PettitWesley
Copy link
Contributor

The code also uses strftime, which doesn't support anything smaller than seconds.

To support milliseconds you have to build a shim on top of strftime. I vaguely remember that some part of fluent bit supports millisecond format specifiers, I think it was %f, but I can't find any code from a cursory search.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Apr 9, 2021
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2022

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

@github-actions github-actions bot added the Stale label Jan 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2022

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as completed Jan 9, 2022
@PettitWesley PettitWesley reopened this Jan 10, 2022
@PettitWesley
Copy link
Contributor

Marking as enhancement so it won't keep getting closed

@PettitWesley PettitWesley changed the title Firehose Output plugin: time_key does not have milliseconds. Firehose & Kinesis Output plugin: time_key does not have milliseconds. Jan 12, 2022
@PettitWesley
Copy link
Contributor

This should be implemented in both kinesis_firehose and kinesis_streams when we get around to it

@Claych
Copy link
Contributor

Claych commented Nov 17, 2022

I'm working on this part, hopefully nanoseconds and milliseconds can be implemented for time_key by the end of this month.

@lubingfeng
Copy link

@Claych are we done with this one?

@matthewfala
Copy link
Contributor

This will be added to aws-for-fluent-bit version 2.31.0, cherrypicked on top of Fluent Bit version 1.9.10.

Please see: #6486

@hackery
Copy link

hackery commented Oct 5, 2023

@matthewfala looks like this can be closed (although I think you linked a different PR above, which is for out_s3) - but see #7538 which describes a bug in the sub-second formatting (printf format string needs a leading-zeros specifier like %03u but I don't know how that works vs. %I64u)

@PettitWesley
Copy link
Contributor

@hackery Thanks, I have opened a new issue for the leading zero bug fix: aws/aws-for-fluent-bit#740

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS Issues with AWS plugins or experienced by users running on AWS enhancement
Projects
None yet
Development

No branches or pull requests

6 participants