Skip to content

Instantly share code, notes, and snippets.

@cveld
cveld / readiislog.scala
Created January 3, 2016 21:31 — forked from anonymous/readiislog.scala
First try to parse IIS (w3c extended format log files with Scala
// http://stackoverflow.com/questions/1284423/read-entire-file-in-scala
//val source = scala.io.Source.fromFile("G:\\test\\2015-12 Logging Eventhub\\W3SVC916189047\\u_ex151130.log")
val source = scala.io.Source.fromFile("testlog.log")
val lines = source.getLines()
//getLogItems(lines).take(5).foreach { line => println(line) }
getLogItems(lines).foreach { line => println(line) }
class LogItemsIterator(lines : Iterator[String]) extends Iterator[collection.mutable.Map[String, String]] {
var _nextLine = None : Option[collection.mutable.Map[String, String]];