Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lean log monitoring in Go

Lean log monitoring in Go

Why It is not a bad thing to build something small when you need it if nothing else fits.
In this talk I will share what went wrong, and what went well, and hopefully bring some inspiration for your team when they face a similar challenge.

Shyamala

July 15, 2020
Tweet

More Decks by Shyamala

Other Decks in Programming

Transcript

  1. Hello! I am Shyamala Site Reliability Engineer @ Volkswagen Digital:Lab

    Berlin @shyamala_u shyamz-22 dev.to/shyamala_u
  2. @shyamala_u The next step was ... To find a logging

    solution that was reliable and sophisticated
  3. @shyamala_u Because …. • Reluctance to let third party to

    process and store logs • Long processes to get through security and legalities • Not enough budget • Not enough capacity to host and manage an on premise solution
  4. @shyamala_u What if we build a simple solution that can...

    • Receive logs from multiple applications • Store pattern configuration per application and where to alert. • Process the incoming log of an application against the configuration • Send alert to configured channel when a match is found
  5. @shyamala_u What is Syslog? In computing, syslog is a standard

    for message logging. It allows separation of : • the software that generates messages • the system that stores them • and the software that reports and analyzes them
  6. @shyamala_u <165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventID="1011"]

    An application event log entry... | Value | Type | |--------------------------------------------|-----------------------| | <86> Facility=10, Severity=6 | Priority | | 1 | Version | | 2003-10-11T22:14:15.003Z | TimeStamp | | mymachine.example.com | Hostname | | evntslog | App Name | | - | ProcID | | [exampleSDID@32473 iut="3" eventID="1011"] | Structured Data | | An applicationevent log entry... | UTF-8 encoded message | What is Syslog?
  7. @shyamala_u we wanted to build a solution that is also...

    • Robust • Low Resource footprint (CPU/RAM) • Low maintenance cost • Reliable
  8. @shyamala_u • Out of Memory Error Logging processed logs is

    a bad idea ‍♀ Replacing `json.Marshal` with `json.Encoder` with buffer from `sync.pool` made significant improvement under load name old time/op new time/op delta Cache/test_put-8 34.2µs ± 1% 33.8µs ± 1% -1.09% (p=0.000 n=10+9) name old alloc/op new alloc/op delta Cache/test_put-8 1.47kB ± 0% 1.33kB ± 0% -9.71% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Cache/test_put-8 42.0 ± 0% 40.0 ± 0% -4.76% (p=0.000 n=10+10) Some hiccups..