Skip to content

Commit

Permalink
#2305 Adjust integrity check timers
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 24, 2022
1 parent 226a60b commit 2d4328d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 69 deletions.
2 changes: 1 addition & 1 deletion ScalliGraph
79 changes: 40 additions & 39 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,46 @@ object Dependencies {
val janusVersion = "0.5.3"
val akkaVersion: String = play.core.PlayVersion.akkaVersion

lazy val specs = "com.typesafe.play" %% "play-specs2" % play.core.PlayVersion.current
lazy val playLogback = "com.typesafe.play" %% "play-logback" % play.core.PlayVersion.current
lazy val playGuice = "com.typesafe.play" %% "play-guice" % play.core.PlayVersion.current
lazy val playFilters = "com.typesafe.play" %% "filters-helpers" % play.core.PlayVersion.current
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.8"
lazy val playMockws = "de.leanovate.play-mockws" %% "play-mockws" % "2.8.0"
lazy val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
lazy val akkaCluster = "com.typesafe.akka" %% "akka-cluster" % akkaVersion
lazy val akkaClusterTools = "com.typesafe.akka" %% "akka-cluster-tools" % akkaVersion
lazy val akkaClusterTyped = "com.typesafe.akka" %% "akka-cluster-typed" % akkaVersion
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % play.core.PlayVersion.akkaHttpVersion
lazy val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % play.core.PlayVersion.akkaHttpVersion
lazy val janusGraph = "org.janusgraph" % "janusgraph" % janusVersion
lazy val janusGraphCore = "org.janusgraph" % "janusgraph-core" % janusVersion
lazy val janusGraphBerkeleyDB = "org.janusgraph" % "janusgraph-berkeleyje" % janusVersion
lazy val janusGraphLucene = "org.janusgraph" % "janusgraph-lucene" % janusVersion
lazy val janusGraphElasticSearch = "org.janusgraph" % "janusgraph-es" % janusVersion
lazy val janusGraphCassandra = "org.janusgraph" % "janusgraph-cql" % janusVersion
lazy val janusGraphInMemory = "org.janusgraph" % "janusgraph-inmemory" % janusVersion
lazy val tinkerpop = "org.apache.tinkerpop" % "gremlin-core" % "3.4.6" // align with janusgraph
lazy val scalactic = "org.scalactic" %% "scalactic" % "3.2.3"
lazy val scalaGuice = "net.codingwell" %% "scala-guice" % "4.2.11"
lazy val shapeless = "com.chuusai" %% "shapeless" % "2.3.3"
lazy val bouncyCastle = "org.bouncycastle" % "bcprov-jdk15on" % "1.68"
lazy val apacheConfiguration = "commons-configuration" % "commons-configuration" % "1.10"
lazy val macroParadise = "org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full
lazy val chimney = "io.scalaland" %% "chimney" % "0.6.1"
lazy val reflections = "org.reflections" % "reflections" % "0.9.12"
lazy val hadoopClient = "org.apache.hadoop" % "hadoop-client" % "3.3.0" exclude ("log4j", "log4j")
lazy val zip4j = "net.lingala.zip4j" % "zip4j" % "2.6.4"
lazy val alpakka = "com.lightbend.akka" %% "akka-stream-alpakka-json-streaming" % "2.0.2"
lazy val handlebars = "com.github.jknack" % "handlebars" % "4.2.0"
lazy val playMailer = "com.typesafe.play" %% "play-mailer" % "8.0.1"
lazy val playMailerGuice = "com.typesafe.play" %% "play-mailer-guice" % "8.0.1"
lazy val pbkdf2 = "io.github.nremond" %% "pbkdf2-scala" % "0.6.5"
lazy val alpakkaS3 = "com.lightbend.akka" %% "akka-stream-alpakka-s3" % "2.0.2"
lazy val commonCodec = "commons-codec" % "commons-codec" % "1.15"
lazy val scopt = "com.github.scopt" %% "scopt" % "4.0.0"
lazy val aix = "ai.x" %% "play-json-extensions" % "0.42.0"
lazy val specs = "com.typesafe.play" %% "play-specs2" % play.core.PlayVersion.current
lazy val playLogback = "com.typesafe.play" %% "play-logback" % play.core.PlayVersion.current
lazy val playGuice = "com.typesafe.play" %% "play-guice" % play.core.PlayVersion.current
lazy val playFilters = "com.typesafe.play" %% "filters-helpers" % play.core.PlayVersion.current
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.8"
lazy val playMockws = "de.leanovate.play-mockws" %% "play-mockws" % "2.8.0"
lazy val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion
lazy val akkaCluster = "com.typesafe.akka" %% "akka-cluster" % akkaVersion
lazy val akkaClusterTools = "com.typesafe.akka" %% "akka-cluster-tools" % akkaVersion
lazy val akkaClusterTyped = "com.typesafe.akka" %% "akka-cluster-typed" % akkaVersion
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % play.core.PlayVersion.akkaHttpVersion
lazy val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % play.core.PlayVersion.akkaHttpVersion
lazy val janusGraph = "org.janusgraph" % "janusgraph" % janusVersion
lazy val janusGraphCore = "org.janusgraph" % "janusgraph-core" % janusVersion
lazy val janusGraphBerkeleyDB = "org.janusgraph" % "janusgraph-berkeleyje" % janusVersion
lazy val janusGraphLucene = "org.janusgraph" % "janusgraph-lucene" % janusVersion
lazy val janusGraphElasticSearch = "org.janusgraph" % "janusgraph-es" % janusVersion
lazy val janusGraphCassandra = "org.janusgraph" % "janusgraph-cql" % janusVersion
lazy val janusGraphInMemory = "org.janusgraph" % "janusgraph-inmemory" % janusVersion
lazy val tinkerpop = "org.apache.tinkerpop" % "gremlin-core" % "3.4.6" // align with janusgraph
lazy val scalactic = "org.scalactic" %% "scalactic" % "3.2.3"
lazy val scalaGuice = "net.codingwell" %% "scala-guice" % "4.2.11"
lazy val shapeless = "com.chuusai" %% "shapeless" % "2.3.3"
lazy val bouncyCastle = "org.bouncycastle" % "bcprov-jdk15on" % "1.68"
lazy val apacheConfiguration = "commons-configuration" % "commons-configuration" % "1.10"
lazy val macroParadise = "org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full
lazy val chimney = "io.scalaland" %% "chimney" % "0.6.1"
lazy val reflections = "org.reflections" % "reflections" % "0.9.12"
lazy val hadoopClient = "org.apache.hadoop" % "hadoop-client" % "3.3.0" exclude ("log4j", "log4j")
lazy val zip4j = "net.lingala.zip4j" % "zip4j" % "2.6.4"
lazy val alpakka = "com.lightbend.akka" %% "akka-stream-alpakka-json-streaming" % "2.0.2"
lazy val handlebars = "com.github.jknack" % "handlebars" % "4.2.0"
lazy val playMailer = "com.typesafe.play" %% "play-mailer" % "8.0.1"
lazy val playMailerGuice = "com.typesafe.play" %% "play-mailer-guice" % "8.0.1"
lazy val pbkdf2 = "io.github.nremond" %% "pbkdf2-scala" % "0.6.5"
lazy val alpakkaS3 = "com.lightbend.akka" %% "akka-stream-alpakka-s3" % "2.0.2"
lazy val commonCodec = "commons-codec" % "commons-codec" % "1.15"
lazy val scopt = "com.github.scopt" %% "scopt" % "4.0.0"
lazy val aix = "ai.x" %% "play-json-extensions" % "0.42.0"
lazy val bloomFilter = "com.github.alexandrnikitin" %% "bloom-filter" % "0.13.1"

def scalaReflect(scalaVersion: String) = "org.scala-lang" % "scala-reflect" % scalaVersion
def scalaCompiler(scalaVersion: String) = "org.scala-lang" % "scala-compiler" % scalaVersion
Expand Down
21 changes: 0 additions & 21 deletions thehive/app/org/thp/thehive/services/IntegrityCheckActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ class IntegrityCheckActor() extends Actor {
result + ("startDate" -> startDate) + ("endDate" -> endDate) + ("duration" -> (endDate - startDate))
}

private var globalTimers: Seq[Cancellable] = Nil

override def preStart(): Unit = {
super.preStart()
implicit val authContext: AuthContext = LocalUserSrv.getSystemAuthContext
Expand All @@ -128,25 +126,6 @@ class IntegrityCheckActor() extends Actor {
integrityCheckOps.foreach { integrityCheck =>
self ! DuplicationCheck(integrityCheck.name)
}
globalTimers = integrityCheckOps.map { integrityCheck =>
val interval = globalInterval(integrityCheck.name)
val initialDelay = FiniteDuration((interval.toNanos * Random.nextDouble()).round, NANOSECONDS)
context
.system
.scheduler
.scheduleWithFixedDelay(initialDelay, interval) { () =>
logger.debug(s"Global check of ${integrityCheck.name}")
val startDate = System.currentTimeMillis()
val result = integrityCheck.globalCheck().mapValues(_.toLong)
val duration = System.currentTimeMillis() - startDate
self ! GlobalCheckResult(integrityCheck.name, result + ("duration" -> duration))
}
}.toSeq
}

override def postStop(): Unit = {
super.postStop()
globalTimers.foreach(_.cancel())
}

override def receive: Receive = {
Expand Down
16 changes: 8 additions & 8 deletions thehive/conf/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ integrityCheck {
default {
initialDelay: 1 minute
interval: 10 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
Profile {
initialDelay: 10 seconds
Expand All @@ -151,8 +151,8 @@ integrityCheck {
}
Tag {
initialDelay: 5 minute
interval: 30 minutes
globalInterval: 6 hours
interval: 6 hours
globalInterval: 5 days
}
User {
initialDelay: 30 seconds
Expand Down Expand Up @@ -187,22 +187,22 @@ integrityCheck {
Data {
initialDelay: 5 minute
interval: 30 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
Case {
initialDelay: 1 minute
interval: 10 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
Alert {
initialDelay: 5 minute
interval: 30 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
Task {
initialDelay: 5 minute
interval: 30 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
Log {
initialDelay: 5 minute
Expand All @@ -212,7 +212,7 @@ integrityCheck {
Observable {
initialDelay: 5 minute
interval: 30 minutes
globalInterval: 6 hours
globalInterval: 5 days
}
}

Expand Down

0 comments on commit 2d4328d

Please sign in to comment.