TheHive-Project / TheHive

TheHive: a Scalable, Open Source and Free Security Incident Response Platform
https://thehive-project.org
GNU Affero General Public License v3.0
3.39k stars 618 forks source link

[Bug] Duplicated entities after "db.janusgraph.forceDropAndRebuildIndex: true" with Elasticsearch index #2333

Closed jpferrero closed 2 years ago

jpferrero commented 2 years ago

Request Type

Bug

Work Environment

Question Answer
OS version (server) CentOS
OS version (client) 7
Virtualized Env. True
Dedicated RAM 16 GB
vCPU 8
TheHive version / git hash 4.17
Package Type RPM
Database Cassandra
Index type Elasticsearch 7.16
Attachments storage Local

If I set the parameter 'db.janusgraph.forceDropAndRebuildIndex: true' when using Elasticsearch as index backend, after a while lots of entities are marked as duplicated and data from observables are lost. This is the log of the reindex

2022-02-03 21:10:36,751 [INFO] from org.thp.scalligraph.models.Database in application-akka.actor.default-dispatcher-13 [|mgmt-296117d3] Reindex job 178b1e59 is running 2022-02-03 21:10:37,182 [INFO] from org.janusgraph.graphdb.database.management.ManagementSystem in Thread-61 [|] Index update job successful for [global5] 2022-02-03 21:10:37,752 [INFO] from org.thp.scalligraph.models.Database in application-akka.actor.default-dispatcher-13 [|mgmt-296117d3] Reindex job 178b1e59 is finished 2022-02-03 21:10:37,891 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-13 [|] Singleton manager starting singleton actor [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:37,891 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-4 [|] ClusterSingletonManager state change [Start -> Oldest] 2022-02-03 21:10:37,930 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-18 [|] Singleton manager starting singleton actor [akka://application/system/singletonManagerCaseNumberLeader/CaseNumberLeader] 2022-02-03 21:10:37,930 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-18 [|] ClusterSingletonManager state change [Start -> Oldest] 2022-02-03 21:10:38,580 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-4 [|] Singleton manager starting singleton actor [akka://application/user/flowSingletonManager/singleton] 2022-02-03 21:10:38,580 [INFO] from akka.cluster.singleton.ClusterSingletonManager in application-akka.actor.default-dispatcher-21 [|] ClusterSingletonManager state change [Start -> Oldest] 2022-02-03 21:10:38,619 [INFO] from play.api.Play in main [|] Application started (Prod) (no global state) 2022-02-03 21:10:38,942 [INFO] from play.core.server.AkkaHttpServer in main [|] Listening for HTTP on /0:0:0:0:0:0:0:0:8000 2022-02-03 21:10:38,943 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-21 [|] Singleton identified at [akka://application/system/singletonManagerCaseNumberLeader/CaseNumberLeader] 2022-02-03 21:10:39,593 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-21 [|] Singleton identified at [akka://application/user/flowSingletonManager/singleton] 2022-02-03 21:10:51,487 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,487 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,487 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,487 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,488 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,489 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,489 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,489 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,489 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,490 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,490 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,490 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,490 [INFO] from akka.cluster.singleton.ClusterSingletonProxy in application-akka.actor.default-dispatcher-4 [|] Singleton identified at [akka://application/user/integrityCheckSingletonManager/singleton] 2022-02-03 21:10:51,636 [INFO] from org.thp.thehive.services.ObservableTypeIntegrityCheckOps in pool-12-thread-1 [|774df931] Found duplicate entities:

Steps to Reproduce

  1. Configure Elasticsearch index
  2. Force reindex with parameter 'db.janusgraph.forceDropAndRebuildIndex: true'
  3. The observables that are considered duplicated disappear from the alert/case: Screen Shot 2022-02-03 at 22 35 57
To-om commented 2 years ago

fixed by #2334