1. 11
  1.  

  2. 3

    Nope. It’s 2017, it’s time to stop parsing strings with regular expressions. Use structured logging.

    No thanks! I’ll stick to strings.

    1. 2

      Could you please explain why? Your comment, as it is, is not bringing any value.

      1. 1

        Not the OP but here’s why I don’t like structured logging

        • logs will ultimately be read by humans and extra syntax gets in the way.
        • structured logging tends to bulk the log with too much useless information.
        • most of the use cases of structured logging could be better handled via instrumentation/metrics.
        • string based logs can be emitted by any language without dependencies so every system you manage could have compatible logging.

        Arguably a space separated line is a fixed-schema structured log with the least extraneous syntax possible.

        1. 6

          To me (in the same order):

          • logs are ultimately read by human once correctly parsed/sorted. Which means that it should be machine readable first so that it can be processed easily to create a readable message.
          • Too much informations is rarely a problem with logging, but not enough context is often an issue.
          • Probably, but structured logging still offers some simpler ways for this.
          • You just push the format problematic from the sender (that can use a simple format) to the receiver (that has to parse different formats according to what devs fancy)

          To me the best recap on why I like structured logging is: https://kartar.net/2015/12/structured-logging/

          1. 2

            most of the use cases of structured logging could be better handled via instrumentation/metrics.

            Speaking as a developer of Prometheus, you need both. Metrics are great for an overall view of the system and all its subsystems, but can’t tell you about every individual user request. Logs tell you about every request, but are limited in terms of understanding the broader system.

            I’ve wrote a longer article that touches on this at https://thenewstack.io/classes-container-monitoring/