Skip to content

Instantly share code, notes, and snippets.

View ethanfrogers's full-sized avatar
💭
thinking about an interesting status message.

Ethan Rogers ethanfrogers

💭
thinking about an interesting status message.
View GitHub Profile
@ethanfrogers
ethanfrogers / multi_unmarshal.go
Created September 18, 2020 14:02
Unmarshal a list of JSON blobs into a list of structs
package main
import (
"encoding/json"
"fmt"
"log"
"reflect"
)
type MyAccount struct {

/* Imagine you have any number of servers (1 to 1000+) that generate log files for your distributed app. Each log file can range from 100MB - 512GB in size. They are copied to your machine which contains only 16GB of RAM.

The local directory would look like this: /temp/server-ac329xbv.log /temp/server-buyew12x.log /temp/server-cnw293z2.log

Our goal is to print the individual lines out to your screen, sorted by timestamp.