Logging and monitoring

Why to log/monitor?

Because it helps in:

  • knowing what's happening in the applications.
  • getting clear details while debugging
  • error reporting,
  • getting warning conditions when users have encountered something unexpected
  • tracing user actions through a common trace ID

Logging

  • Logs are the messages emitted by applications for certain events.
  • Real-time logging allows watching logs stream in from users on the platform.
  • Searchable logs:
    • Using Tags
      • These are special markers assigned to each log as it come in.
      • e.g. environment:production, severity:error, service:accounts.
      • Helps to keep track of what type of log it is and where it came from.
    • Using Attributes
      • These are the details within each log message.
      • e.g. @event.outcome:failure , @http.useragent.device:desktop , or @trace_id:2fb45a.
  • Pre-processing logs
    • It can be used to get some metadata from logs into actionable tags/attributes.
    • Sends logs through a pipeline where the logs can be formatted and tagged as required.

Monitoring

  • Alerts
    • In regular interval of times (say in every 1 hour)
    • Only when it is requried (like when there are more than 10 messages of this type)
    • Send alerts to Slack/Mail.
  • Keeping track of metrics within the application.
    • e.g. logs(status:error)
  • Real User Monitoring (RUM)
    • Track clicks & response times
  • Application Performance Management (APM):
    • tells how long your requests take.
    • shows waterfalls where the processing is slowest.

Tools


More Readings!