# Search guard doing compliance check for each index causing huge delay in ES restart

**URL:** <https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689>\
**Category:** Search Guard\
**Created:** [November 1, 2019, 10:07am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689 "2019-11-01T10:07:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 1, 2019, 10:07am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/1 "2019-11-01T10:07:00Z")

</div>

Hi All,

Our cluster configuration: 1 Master Node, 1 Data Node, 1 Client Node with ELK version 7.4 and we have Search Guard plug-in enabled in all nodes with version 7.x.

We have also enabled debug log for SG in log4j.properties

logger.searchguard.name = com.floragunn  
logger.searchguard.level = debug

When we try rebooting ES data Node, we are observing that for each of our index, SG is doing a compliance/audit check which is causing huge delay in getting back the ES instance up and running. Is there a way to disable the same as we have around 1000+ indexes and the delay is leading to huge down time (more than 2 hours) ?

Sample log entries below :-

[2019-11-01T03:17:50,479][DEBUG][c.f.s.SearchGuardPlugin] [data-1] Compliance config is null because of dlsFlsAvailable: false and auditLog=class com.floragunn.searchguard.auditlog.NullAuditLog  
…  
[2019-11-01T03:32:18,302][DEBUG][c.f.s.SearchGuardPlugin] [data-1] Handle complianceConfig=null/dlsFlsAvailable: false/auditLog=class com.floragunn.searchguard.auditlog.NullAuditLog for onIndexModule() of index k8\_ms\_logs-2019.10.31  
[2019-11-01T03:32:37,654][DEBUG][c.f.s.SearchGuardPlugin] [data-1] Handle complianceConfig=null/dlsFlsAvailable: false/auditLog=class com.floragunn.searchguard.auditlog.NullAuditLog for onIndexModule() of index .monitoring-es-6-2019.10.31

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 4, 2019, 2:54pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/2 "2019-11-04T14:54:51Z")

</div>

Team,

Any suggestions for the original observation here would really help us moving forward

Thanks.

---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [November 4, 2019, 4:16pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/3 "2019-11-04T16:16:01Z")

</div>

I had a look at the code in question, but I cannot explain why this should lead to a 2h downtime.

It is true that Elasticsearch calls this particular method for every index. This is inherent to Elasticsearch and cannot be changed.

However, since neither DLS/FLS nor Audit Logging is used (see e.g. “NullAuditLog”), there is not much going on in this method. In your case, two objects are instantiated and assigned, not much more.

What is the reason that you suspect this particular code / step causing the delay? “Jus” the logfile?

@hsaly any ideas?

---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [November 4, 2019, 4:16pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/4 "2019-11-04T16:16:24Z")

</div>

Unassigned @hsaly on November 4, 2019, 4:16pm UTC



---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [November 4, 2019, 4:16pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/5 "2019-11-04T16:16:31Z")

</div>

Assigned @hsaly on November 4, 2019, 4:16pm UTC



---

<div class="post-metadata">

**Author:** ![cstaley](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/cstaley/32/463_2.png) [@cstaley](https://forum.search-guard.com/u/cstaley)\
**Post date:** [November 4, 2019, 4:46pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/6 "2019-11-04T16:46:34Z")

</div>

Unassigned @hsaly on November 4, 2019, 4:46pm UTC



---

<div class="post-metadata">

**Author:** ![cstaley](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/cstaley/32/463_2.png) [@cstaley](https://forum.search-guard.com/u/cstaley)\
**Post date:** [November 4, 2019, 4:46pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/7 "2019-11-04T16:46:37Z")

</div>

Assigned @cstaley on November 4, 2019, 4:46pm UTC



---

<div class="post-metadata">

**Author:** ![cstaley](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/cstaley/32/463_2.png) [@cstaley](https://forum.search-guard.com/u/cstaley)\
**Post date:** [November 4, 2019, 4:50pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/8 "2019-11-04T16:50:32Z")

</div>

I dont think that this 2h delay is subject to “compliance check” or Search Guard at all. Looking at your cluster topology I assume that 1000+ indices for a single data node is to much (would be interesting how many shards you have and what your hardware looks like). For a production setup you should have at least 3 dedicated master nodes and 2 data nodes.

Do you see this kind of delay with Search Guard disabled or uninstalled?

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 7, 2019, 4:17am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/9 "2019-11-07T04:17:54Z")

</div>

Apologize for the delay . Yes based on log file as we can see this going on for each and every index and only after everything s complete, the ES instance is getting back online

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 7, 2019, 4:25am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/10 "2019-11-07T04:25:25Z")

</div>

Hi @hsaly ,

Thanks and apologize for the delay in response from my side.

As I have stated in the original request, the observation is against our DEV instance.

In production, we do have the following setup

1. 2 ES Master nodes (we will add a new master node master-3 very soon)
2. 2 ES Data Nodes
3. 2 ES client nodes

But in production, we still have ELK running with version 6.3.0 and very soon we will upgrade to 7.x . We want to confirm whether the upgrade to 7.x does not not break things for us so we started with DEV instance with ELK and SG version 7.x . The DEV instance config are

1 master node (3 GB heap),  
1 data node (6 GB heap)  
1 client node (4 GB heap)

And for your point “Do you see this kind of delay with Search Guard disabled or uninstalled?” and the answer is yes, we disabled SG in one of our environments and the restart is faster than the one with SG enabled.

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 7, 2019, 4:29am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/11 "2019-11-07T04:29:05Z")

</div>

+1 to my reply above. Is there a way to disable the compliance check though a property that we can define in elasticsearch.yml ? We can try that out and see whether the re-start time is coming down

---

<div class="post-metadata">

**Author:** ![hsaly](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/hsaly/32/21_2.png) [@hsaly](https://forum.search-guard.com/u/hsaly)\
**Post date:** [November 11, 2019, 9:28pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/12 "2019-11-11T21:28:42Z")

</div>

So how much faster ist the cluster restart with Search Guard disabled?

Can you please also provide logs from all your dev nodes from from the point in time they start up undtil the cluster is green? (with Search Guard enabled of course)

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 13, 2019, 5:21am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/13 "2019-11-13T05:21:29Z")

</div>

Sure will share this weekend as having a another downtime this week is not allowed for us. Will shutdown ELK by Friday IST and restart and capture all and share to you.

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 20, 2019, 4:07am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/14 "2019-11-20T04:07:06Z")

</div>

Apologize for the delay. Still behind on this. Will share this week

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [November 24, 2019, 10:18am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/15 "2019-11-24T10:18:09Z")

</div>

[elk-cluster.zip](https://forum.search-guard.com/uploads/short-url/v08iI6afVNuprFjxkeIPLYxTguP.zip) (10.3 KB)

Hi All,  
Attaching the logs (elk\*.zip) .Please note the time it takes to restart. Since we have removed a whole lot of indexes, the restart appear to be littler faster than before. But still its more than 5 mins. You may refer the below log entries. Now we have a total of 294 indexes . For that it takes close to 7+ mins to restart. If we have more indexes, more time it takes.

**Start time: [2019-11-24T02:34:53,373]**[INFO][o.e.e.NodeEnvironment] [data-1] using [1] data paths, mounts [[/app/data (acs-brm-zfs-01:/export/oasp-dev-elk/indexes)]], net usable\_space [1tb], net total\_space [2.9tb], types [nfs4]

**End time (Where the data node is intialized and ready to access):**  
**[2019-11-24T02:42:15,897]**[INFO][c.f.s.c.ConfigurationRepository] [data-1] Node ‘data-1’ initialized

-Thanks

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [December 2, 2019, 4:22am UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/16 "2019-12-02T04:22:25Z")

</div>

Hi Team,

Need your help to review the attached logs (Please refer previous reply) and guide us on whether we can disable SG compliance check or any other way we can speed up the ES restart with SG enabled.

- Thanks

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [December 9, 2019, 5:16pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/17 "2019-12-09T17:16:31Z")

</div>

Team,

Would be of great help if we get a guidance on this

Regards,  
Shankar

---

<div class="post-metadata">

**Author:** ![shanky1978](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@shanky1978](https://forum.search-guard.com/u/shanky1978)\
**Post date:** [December 16, 2019, 12:18pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/18 "2019-12-16T12:18:43Z")

</div>

Team,

We had already provided the logs that you had asked for. Waiting for your suggestions.

---

<div class="post-metadata">

**Author:** ![hsaly](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/hsaly/32/21_2.png) [@hsaly](https://forum.search-guard.com/u/hsaly)\
**Post date:** [December 16, 2019, 5:17pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/19 "2019-12-16T17:17:00Z")

</div>

So how much faster ist the cluster restart with Search Guard disabled (when nothing else changed)? Please provide the same logs when you restart the node with SG disabled or removed.

Looking into the logs just makes me believe that the time the node needs to come up is because of normal index recovery which is also happens without Search Guard installed. Search Guard should not any significant delay with regards to node startup time/recovery. Looking on you dev cluster setup I think 6 GB ram for a 7.x data node containing more than 200 indices (and probably a lot more shards) is not enough.

Please also refer to

- [Configuration params to address slow node start - Elasticsearch - Discuss the Elastic Stack](https://discuss.elastic.co/t/configuration-params-to-address-slow-node-start/70812)
- [Elasticsearch 6.3.0 shard recovery is slow - Elasticsearch - Discuss the Elastic Stack](https://discuss.elastic.co/t/elasticsearch-6-3-0-shard-recovery-is-slow/140940)
- [How many shards should I have in my Elasticsearch cluster? | Elastic Blog](https://www.elastic.co/de/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster)

---

<div class="post-metadata">

**Author:** ![hsaly](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/hsaly/32/21_2.png) [@hsaly](https://forum.search-guard.com/u/hsaly)\
**Post date:** [December 16, 2019, 5:54pm UTC](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689/20 "2019-12-16T17:54:20Z")

</div>

Unassigned @cstaley on December 16, 2019, 5:54pm UTC



[Next page](https://forum.search-guard.com/t/search-guard-doing-compliance-check-for-each-index-causing-huge-delay-in-es-restart/1689.md?page=2)
