Structured Logging
The idea is that if we structure the information better, it would make it easier to search for specific details. For example, the previously mentioned ELK and Splunk log monitoring products allow us to search in our log data using indexes and aggregate relevant indicators in graphs and dashboards. But to take advantage of this, we need to write out logs in a JSON format.
Even more importantly, a JSON format would make it easier to store and retrieve complex structured data using a consistent schema.
LogEntry
We start by defining a LogEntry type that will contain the details of what we want to log. We can log the current time, the machine hostname, and the log message; of course, each application will need a different set of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access