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

Filebeat fails to decode a zero-value time.Time from the registry #34648

Closed
belimawr opened this issue Feb 22, 2023 · 2 comments
Closed

Filebeat fails to decode a zero-value time.Time from the registry #34648

belimawr opened this issue Feb 22, 2023 · 2 comments
Labels
bug Stalled Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@belimawr
Copy link
Contributor

  • Version: main
  • Operating System: Linux (probably all)

The registry entry for a filestream input looks like this:

{
  "k": "filestream::my-filestream-id::native::158035-34",
  "v": {
    "meta": {
      "identifier_name": "native",
      "source": "/tmp/flog.log"
    },
    "ttl": 0,
    "updated": [
      281470681743360,
      18446744011573954816
    ],
    "cursor": null
  }
}

The updated field is a timestamp encoded by our typeconv package. time.Time are encoded as a array of two uint64, the code that does this transformation is:
https://github.com/elastic/elastic-agent-libs/blob/f17cb1de6337603f16629d4754bcf8c27e0cc8be/transform/typeconv/typeconv.go#L217-L268.

This code alone can successfully encode/decode a zero-value time.Time, however when it gets serialised/deserialised as JSON by Filebeat's registry it is read as 0000-12-31T23:55:44Z, here is an example of the state being dumped by delve:

github.com/elastic/beats/v7/filebeat/input/filestream/internal/input-logfile.state {
        TTL: 0,
        Updated: time.Time(0000-12-31T23:55:44Z){
                wall: 0,
                ext: -256,
                loc: *time.Location nil,},
        Cursor: interface {} nil,
        Meta: interface {}(map[string]interface {}) [
                "source": *(*interface {})(0xc000174ce8), 
                "identifier_name": *(*interface {})(0xc000174cf8), 
        ],}
(dlv) 

Only the first entry from a file in the registry contains a zero-value timestamp in the updated field, at the moment I am not aware of any bug caused by this behaviour. updated seem only to be used to perform some store clean up tasks.

@belimawr belimawr added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Feb 22, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@cmacknz cmacknz added Team:Elastic-Agent Label for the Agent team bug labels Feb 22, 2023
@botelastic
Copy link

botelastic bot commented Feb 22, 2024

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Feb 22, 2024
@botelastic botelastic bot closed this as completed Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Stalled Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

3 participants