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

Logs in other formats #95

Open
vatavale opened this issue Jul 3, 2022 · 4 comments
Open

Logs in other formats #95

vatavale opened this issue Jul 3, 2022 · 4 comments

Comments

@vatavale
Copy link

vatavale commented Jul 3, 2022

Is it possible to logging in JSON format (like GELF format)?
To have a more meaningful structured data in tools like Seq, Graylog, Logstash, Fluentd...

@funkyfuture
Copy link
Owner

well, i'd like to consider deck-chores as feature-complete. but i'm not completely against adding features, it just depends on the concrete proposal. regarding your request:

  • it must be clarified whether GELF or a custom JSON-based format shall be emitted
  • someone must provide a full design proposal that needs to be agreed upon
  • someone must implement the feature eventually in a maintainable manner

@vatavale
Copy link
Author

vatavale commented Jul 5, 2022

I recently started using docker and centralized log collection systems. I do not have considerable expertise, but there are some observations.

In practice I noticed that for example Traefik has a switch for log format (common/json) .

I use Seq to collect logs from Docker containers.
In correspondence with support they told me that Seq supports Compact Log Event Format (CLEF): https://clef-json.org/.

As far as I understand, the application itself doesn't need to support GELF or other ways to send logs to the collectors (transport layer).

The application only needs to encode its messages as a JSON string with some predefined keys (importance level, message header).

For example, in PHP I can easily generate an array of any nested information I want. And then I add two additional predefined fields (according to the CLEF specification):

    @l - the importance level
    @m - a generalized text message

Then I just encode the array before outputting it to JSON.

In the log collector interface the messages received in JSON format are automatically converted into structured data with the possibility of expansion, filtering, alerts, etc.

@vatavale
Copy link
Author

There is also python-json-logger.

@funkyfuture
Copy link
Owner

okay, given that there are many log formats of interest now and in the future, the only feasible way is a plugin-based approach.

if anyone is seriously interested to implement this, let me know so i can provide general pointers for the endeavor.

@funkyfuture funkyfuture changed the title Logs in JSON format Logs in other formats Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants