Skip to content

Instantly share code, notes, and snippets.

@brabster
Created September 6, 2018 10:22
Show Gist options
  • Save brabster/dcd6e357423a29b65694b9383d39d20a to your computer and use it in GitHub Desktop.
Save brabster/dcd6e357423a29b65694b9383d39d20a to your computer and use it in GitHub Desktop.

Revisions

  1. brabster created this gist Sep 6, 2018.
    8 changes: 8 additions & 0 deletions AccessLog.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    object AccessLog {
    case class Entry(clientIp: String, userId: String, timestamp: Instant, path: String, statusCode: Int)

    def parseLine(line: String): Entry = line.split(",") match {
    case Array(clientIp, userId, timestamp, path, statusCode) =>
    Entry(clientIp, userId, new Instant(timestamp), path, statusCode.toInt)
    }
    }