Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Migration tool migrates unsupported elastic index #1907

Closed
mamoedo opened this issue Mar 29, 2021 · 9 comments
Closed

[Bug] Migration tool migrates unsupported elastic index #1907

mamoedo opened this issue Mar 29, 2021 · 9 comments
Assignees
Labels
bug TheHive4 TheHive4 related issues
Milestone

Comments

@mamoedo
Copy link

mamoedo commented Mar 29, 2021

Request Type

Bug

Work Environment

Question Answer
OS version (server) Ubuntu
TheHive source version / git hash 3.4.2
TheHive target version / git hash 4.1.1

Problem Description

I am using the migration tool to migrate from THv3.4.2 to 4.1.1 going through 3.5.1. In my elastic i have _15 and _17 indexes.

When i use the migration tool i am having problems because the tool is trying to use _15 index and deeping on the code i think if this portion of code (https://github.com/TheHive-Project/TheHive/blob/main/migration/src/main/scala/org/thp/thehive/migration/th3/DBConfiguration.scala#L208)

val index_3_5_1 = indexBaseName + "_17"
val index_3_5_0 = indexBaseName + "_16"

because the val _15 is for 3.4.2

val index_3_4_2 = indexBaseName + "_15"

Possible Solutions

Change this code to use _17 index

@mamoedo mamoedo added TheHive4 TheHive4 related issues bug labels Mar 29, 2021
@nadouani nadouani added this to the 4.1.2 milestone Mar 29, 2021
@To-om
Copy link
Contributor

To-om commented Mar 29, 2021

@mamoedo you're right, nice catch

To-om added a commit that referenced this issue Mar 29, 2021
@To-om To-om closed this as completed Mar 29, 2021
@leroy3893
Copy link

Creating an alias _15 in the Elasticsearch for _17 can solve the problem too

@nunofranciscomoreira
Copy link

What about not appending anything to the value passed on the "-i, --es-index" flags???? Or at least document that you do this appending.

That sounds like something you would expect a script to do, specially when it allows the user to specify values as parameters, don't you think?

Just so you know, the change breaks the migration for installations with the index the_hive_15 which worked before.

@mamoedo
Copy link
Author

mamoedo commented Jun 7, 2021

@nunofranciscomoreira but migration is not supported from TH 3.4, which is the one tha has the_hive_15 as index. So even if you could migrate that index, it wouldn't be supported as they said on the docs.

@nunofranciscomoreira
Copy link

The whole point of this tool was to migrate stuff from 3 to 4. It supported 3.4 until this stupid change.

@mamoedo
Copy link
Author

mamoedo commented Jun 7, 2021

@nunofranciscomoreira I'm sorry that you think that the change it's stupid, but TH 3.4 was never supposed to be supported, but TH 3.5 did, so this change is neccesary. TH 3.4 is not the same as TH 3.5.

@nunofranciscomoreira
Copy link

Please read the docs.
It clearly reads: "All packages of TheHive4 distributed come with the migration program which can be used to import data from TheHive 3.4.0+. By default, it is installed in /opt/thehive/bin/migrate."

@mamoedo
Copy link
Author

mamoedo commented Jun 7, 2021

Sorry I was thinking about TH4.1X which is "the good one"

@nunofranciscomoreira
Copy link

Creating an alias _15 in the Elasticsearch for _17 can solve the problem too

I'm currently trying the alias workaround and it looks promising.

Sorry I was thinking about TH4.1X which is "the good one"

I'm glad that we can see clear now 😃 I've tried, with no luck, to build a "fixed" version on my machine, but I'm getting all sort of errors while building using ./sbt. Adding the indexBaseName + "_15" back should fix it for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug TheHive4 TheHive4 related issues
Projects
None yet
Development

No branches or pull requests

5 participants