All Downloads are FREE. Search and download functionalities are using the official Maven repository.

streaming.dsl.load.batch.LogTail.scala Maven / Gradle / Ivy

The newest version!
package streaming.dsl.load.batch

import streaming.common.shell.ShellCommand


/**
  * 2019-04-02 WilliamZhu([email protected])
  */
object LogTail {

  def log(owner: String, filePath: String, offset: Long, size: Int = 1024 * 1024 - 1) = {
    val (newOffset, msg, fileSize) = ShellCommand.progress(filePath, offset, size)
    val newMsg = msg.split("\n").filter(f => f.contains(s"[owner] [${owner}]"))
    LogMsg(newOffset, newMsg)
  }
}

case class LogMsg(offset: Long, msg: Seq[String])








© 2015 - 2024 Weber Informatics LLC | Privacy Policy