deck-chores icon indicating copy to clipboard operation
deck-chores copied to clipboard

Logs in other formats

Open vatavale opened this issue 2 years ago • 4 comments

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...

vatavale avatar Jul 03 '22 14:07 vatavale

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

funkyfuture avatar Jul 05 '22 13:07 funkyfuture

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 avatar Jul 05 '22 14:07 vatavale

There is also python-json-logger.

vatavale avatar Jul 23 '22 06:07 vatavale

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 avatar Aug 23 '22 15:08 funkyfuture