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

Undocumented "error" field appears in JSON logs #300

Open
1 task done
baterja opened this issue Jan 20, 2025 · 5 comments · Fixed by #301
Open
1 task done

Undocumented "error" field appears in JSON logs #300

baterja opened this issue Jan 20, 2025 · 5 comments · Fixed by #301

Comments

@baterja
Copy link

baterja commented Jan 20, 2025

Bug Description

It's only a documentation "bug".

JSON logs structure reported there in the docs:
https://docs.flipt.io/configuration/observability#json
doesn't contain all possible fields because practice shows that "error" field may appear in the log:

{ 
  "L":"ERROR",
  "T":"2025-01-13T16:54:57Z",
  "M":"error getting file system from directory",
  "server":"grpc",
  "error":"flag <anonymised> rule 1 references unknown segment \"<anonymised>\""
}

We were relying on only putting "M" field into our centralized logging system so we missed important error details.

Version Info

v1.50.0

Search

  • I searched for other open and closed issues before opening this

Steps to Reproduce

  1. Use S3 as a flag definitions source.
  2. Add a flag definition with a rule that uses a nonexisting "segment"

Expected Behavior

No response

Additional Context

No response

@baterja baterja added the bug Something isn't working label Jan 20, 2025
Copy link

dosubot bot commented Jan 20, 2025

Hey @baterja! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

The "error" field in the JSON logs appears when there is an issue related to flag definitions, such as referencing a nonexisting segment. This is part of the error handling mechanism in the system, where specific errors are logged to provide more context about the issue. The logic for handling such errors is implemented in the internal/storage/fs/snapshot_test.go file, where errors related to unknown segments are captured and logged [1].

To address the documentation bug, it would be beneficial to update the documentation to include the "error" field as a possible entry in the JSON logs. This ensures that users are aware of all potential fields that might appear in the logs, allowing them to capture and process important error details effectively.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@markphelps
Copy link
Contributor

Hey @baterja thanks for the issue!

In the above linked documentation (https://docs.flipt.io/configuration/observability#json) you can see a similar L key which stands for LEVEL, or log level. In the docs we just have 'INFO' as the value, but of course if there is an error it will log at 'ERROR' level.

"L": "INFO",

We could do a better job of describing those keys though I agree.

Some of those keys are also configurable, (L being one): https://docs.flipt.io/configuration/overview#logging

@markphelps markphelps removed the bug Something isn't working label Jan 20, 2025
@markphelps markphelps transferred this issue from flipt-io/flipt Jan 20, 2025
@markphelps markphelps changed the title [Bug]: Undocumented "error" field appears in JSON logs Undocumented "error" field appears in JSON logs Jan 20, 2025
@baterja
Copy link
Author

baterja commented Jan 20, 2025

Thanks for transferring it to the documentation repo, I wasn't aware of its existence :)

markphelps added a commit that referenced this issue Jan 20, 2025
Fixes #300

Update JSON logs documentation to include 'error' field and explain log keys

* Remove the example JSON log structure.
* Add a section explaining what each key stands for.
* Include possible values for the 'L' key.
* Mention that the 'error' field may appear in the log.
* Elaborate on the timestamp and message descriptions.
markphelps added a commit that referenced this issue Jan 21, 2025
* Update JSON logs documentation to include 'error' field

Fixes #300

Update JSON logs documentation to include 'error' field and explain log keys

* Remove the example JSON log structure.
* Add a section explaining what each key stands for.
* Include possible values for the 'L' key.
* Mention that the 'error' field may appear in the log.
* Elaborate on the timestamp and message descriptions.

* chore: Update observability.mdx

* chore: Update observability.mdx

* chore: Update observability.mdx
@github-project-automation github-project-automation bot moved this to Done in Roadmap Jan 21, 2025
@baterja
Copy link
Author

baterja commented Jan 21, 2025

Hello! It's great how fast you react to any issue reported there, but are you sure it should be completed? That report mainly addressed the lack of a description of an "error" field in the JSON log (particularly the error log). I see you added descriptions of the "main" fields of the JSON but the "error" field existence is still not mentioned.

@markphelps
Copy link
Contributor

@baterja ah I see. I misunderstood the original issue. you're right that we should document the addition of the error field if its an error log

@markphelps markphelps reopened this Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants