# Unable to run Diagnostic tool

**URL:** <https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561>\
**Category:** Elasticsearch\
**Created:** [May 1, 2024, 12:52pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561 "2024-05-01T12:52:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivekchander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekchander/32/134050_2.png) [@Vivekchander](https://discuss.elastic.co/u/Vivekchander)\
**Post date:** [May 1, 2024, 12:52pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561/1 "2024-05-01T12:52:24Z")

</div>

Hi All,

I'm pretty new to Elastic. I installed Elasticsearch on a cluster and I was able to port forward and access elastic cluster locally from the browser localhost:9200 just fine.

Now from a different command prompt i'm trying to run the support diagnostic and I get this below cert error. Appreciate any pointers here to resolve this.

```auto
C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0>diagnostics.bat
JAVA_HOME found, using C:\oraclejava
Using -Xms256m -Xmx2000m for options.
ERROR StatusConsoleListener Unable to locate appender "diag" for logger config "root"
Command line options can be displayed with the --help argument. Entering interactive mode.

Bypass the diagnostic version check. Use when internet outbound HTTP access is blocked by a firewall. (Y/N) [N]: y

Enter the number of the diagnostic type to run.
* 1: local - Node on the same host as the diagnostic utility.
  2: remote - Node on a different host than the diagnostic utility
  3: api - Elasticsearch REST API calls, no system calls or logs.
  4: logstash-local - Logstash process on the same host as the diagnostic utility.
  5: logstash-remote - Logstash on a different host than the diagnostic utility.
  6: logstash-api - Logstash REST calls. No system calls.
  7: kibana-api - Kibana REST calls. No system calls.
  8: kibana-remote - Kibana on a different host than the diagnostic utility.
  9: kibana-local - Kibana process on the same host as the diagnostic utility.
Enter your choice: 1

Required field. Hostname, IP Address, or localhost. HTTP access for this node must be enabled: [localhost]:

Listening port. Defaults to 9200: [9200]:

Use https to access the cluster? (Y/N) [Y]:

Bypass hostname verification for certificate? This is unsafe and NOT recommended. (Y/N) [N]:

Cluster secured? (Y/N) [Y]:

Type of authentication to use:
* 1: Username/Password:
  2: PKI:
Enter your choice: 1

Elasticsearch user account: elastic

Elasticsearch user password: ************************

Http Proxy Server present? (Y/N) [N]:

Fully qualified path to an output directory. If it does not exist the diagnostic will attempt to create it. If not specified the diagnostic directory will be used:

File type that will be used to compress the output directory. Choose between: 'zip', 'tar' or 'any'. 'any' will try to zip first and fallback to tar if the zip fails. Defaults to any. [any]:

Creating temp directory: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics
Configuring log file.
Diagnostic logger reconfigured for inclusion into archive
Getting Elasticsearch Version.
Closing loggers.
Archiving diagnostic results.
Archive: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics-20240501-123339.zip was created
Delete of directory:C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics failed. Usually this indicates a permission issue
org.apache.commons.io.IOExceptionList: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:331) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1192) ~[commons-io-2.11.0.jar:2.11.0]
        at co.elastic.support.util.SystemUtils.nukeDirectory(SystemUtils.java:51) [diagnostics-8.5.0.jar:8.5.0]
        at co.elastic.support.diagnostics.DiagnosticService.exec(DiagnosticService.java:98) [diagnostics-8.5.0.jar:8.5.0]
        at co.elastic.support.diagnostics.DiagnosticApp.main(DiagnosticApp.java:51) [diagnostics-8.5.0.jar:8.5.0]
Caused by: java.io.IOException: Cannot delete file: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\diagnostics.log
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1344) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:324) ~[commons-io-2.11.0.jar:2.11.0]
        ... 4 more
Caused by: java.nio.file.FileSystemException: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\diagnostics.log: The process cannot access the file because it is being used by another process.

        at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) ~[?:1.8.0_411]
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_411]
        at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) ~[?:1.8.0_411]
        at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source) ~[?:1.8.0_411]
        at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source) ~[?:1.8.0_411]
        at java.nio.file.Files.deleteIfExists(Unknown Source) ~[?:1.8.0_411]
        at org.apache.commons.io.file.PathUtils.deleteFile(PathUtils.java:487) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.file.PathUtils.delete(PathUtils.java:392) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1341) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:324) ~[commons-io-2.11.0.jar:2.11.0]
        ... 4 more
Fatal error occurred: Could not retrieve the Elasticsearch version due to a system or network error - unable to continue. Certificate for <localhost> doesn't match any of the subject alternative names: [wxd-es-http.elastic.es.local, wxd-es-http, wxd-es-http.elastic.svc, wxd-es-http.elastic, wxd-es-internal-http.elastic.svc, wxd-es-internal-http.elastic, *.wxd-es-default.elastic.svc]
Check diagnostics.log in the archive file for more detail.. Check diagnostics.log in the archive file for more detail.

```

Thanks,

Vivek

---

<div class="post-metadata">

**Author:** ![Vivekchander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekchander/32/134050_2.png) [@Vivekchander](https://discuss.elastic.co/u/Vivekchander)\
**Post date:** [May 1, 2024, 1:09pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561/2 "2024-05-01T13:09:09Z")

</div>

@jadhav.datta Were you able to find the solution for this issue ? I see you had the same problem - [Support-diagnostics](https://discuss.elastic.co/t/support-diagnostics/294925)

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 1, 2024, 3:04pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561/3 "2024-05-01T15:04:59Z")

</div>

You chose `localhost` here ...

> [@Vivekchander](#):
>
> `Hostname, IP Address, or localhost. HTTP access for this node must be enabled: [localhost]:`

... and said `N` here ...

> [@Vivekchander](#):
>
> `Bypass hostname verification for certificate? This is unsafe and NOT recommended. (Y/N) [N]:`

... but `localhost` isn't the name on your node's certificate:

> [@Vivekchander](#):
>
> `Certificate for <localhost> doesn't match any of the subject alternative names: [wxd-es-http.elastic.es.local, wxd-es-http, wxd-es-http.elastic.svc, wxd-es-http.elastic, wxd-es-internal-http.elastic.svc, wxd-es-internal-http.elastic, *.wxd-es-default.elastic.svc]`

You either need to specify the right name instead of `localhost`, or else say `Y` when asked if you want to bypass hostname verification.

---

<div class="post-metadata">

**Author:** ![Vivekchander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekchander/32/134050_2.png) [@Vivekchander](https://discuss.elastic.co/u/Vivekchander)\
**Post date:** [May 1, 2024, 3:14pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561/4 "2024-05-01T15:14:33Z")

</div>

Hello David,

Thanks. I got past the issue by running something like beolow:

```auto

diagnostics.bat --type local --ssl --host localhost --port 9200 -u elastic -p --noVerify

```

I see that logs are being written:

```auto

Results written to: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\commercial\slm_status.json
Results written to: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\commercial\transform.json

```

But i do not see any 'commercial' folder created.

I see messages like below:

```auto
The elasticsearch user entered: elastic does not appear to have sufficient authorization to access all collected information
Some of the calls may not have completed successfully.
If you are using a custom role please verify that it has the admin role for versions prior to 5.x or the superuser role for subsequent versions.

```

```auto
Archive: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics-20240501-144214.zip was created
Delete of directory:C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics failed. Usually this indicates a permission issue
org.apache.commons.io.IOExceptionList: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:331) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1192) ~[commons-io-2.11.0.jar:2.11.0]
        at co.elastic.support.util.SystemUtils.nukeDirectory(SystemUtils.java:51) [diagnostics-8.5.0.jar:8.5.0]
        at co.elastic.support.diagnostics.DiagnosticService.exec(DiagnosticService.java:98) [diagnostics-8.5.0.jar:8.5.0]
        at co.elastic.support.diagnostics.DiagnosticApp.main(DiagnosticApp.java:51) [diagnostics-8.5.0.jar:8.5.0]
Caused by: java.io.IOException: Cannot delete file: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\diagnostics.log
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1344) ~[commons-io-2.11.0.jar:2.11.0]
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:324) ~[commons-io-2.11.0.jar:2.11.0]
        ... 4 more
Caused by: java.nio.file.FileSystemException: C:\Users\5G7267897\Desktop\Diagnostics\diagnostics-8.5.0\local-diagnostics\diagnostics.log: The process cannot access the file because it is being used by another process.

```

I user with who I am executing the bat file does have read write permissions on the folders. Not sure what I'm missing.

---

<div class="post-metadata">

**Author:** ![Vivekchander](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivekchander/32/134050_2.png) [@Vivekchander](https://discuss.elastic.co/u/Vivekchander)\
**Post date:** [May 1, 2024, 3:30pm UTC](https://discuss.elastic.co/t/unable-to-run-diagnostic-tool/358561/5 "2024-05-01T15:30:51Z")

</div>

The 'elastic' user is indeed a 'superuser'. So it should have the necessary permission.
