# Pipeline error {:pipeline\_id=\>"main", :exception=\>#\<NoMethodError: undefined method \`close' for nil:NilClass\>

**URL:** <https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706>\
**Category:** Logstash\
**Created:** [February 9, 2022, 10:09am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706 "2022-02-09T10:09:21Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 11, 2022, 11:07am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/24 "2022-02-11T11:07:12Z")

</div>

@Badger I found the parameters what you say about, they're in file named as startup.options:

```auto

# Set a home directory
LS_HOME=/usr/share/logstash

# logstash settings directory, the path which contains logstash.yml
LS_SETTINGS_DIR=/etc/logstash

# Arguments to pass to logstash
LS_OPTS="--path.settings ${LS_SETTINGS_DIR}"

```

Do you mean that I need to change them?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 11, 2022, 4:09pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/25 "2022-02-11T16:09:44Z")

</div>

> [@Dark\_Man](#):
>
> Do you mean that I need to change them?

No, you need to find out what actual values are being used.

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 14, 2022, 3:51am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/26 "2022-02-14T03:51:13Z")

</div>

Hello @Badger , can you tell me please, where can I find `--config.debug` parameter for print the value of path.settings that logstash is using?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 14, 2022, 3:54am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/27 "2022-02-14T03:54:49Z")

</div>

It is a [command line](https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html) option.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 14, 2022, 5:53pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/29 "2022-02-14T17:53:08Z")

</div>

> [@Dark\_Man](#):
>
> -f /etc/logstash/logstash.yml

-f (path.config) should point to the logstash configuration file, not the yml.

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 15, 2022, 12:46pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/30 "2022-02-15T12:46:53Z")

</div>

@Badger which file do you mean by logstash configuration file? Is it .conf file or another one?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 15, 2022, 4:54pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/31 "2022-02-15T16:54:38Z")

</div>

Yes, the .conf file that defines the inputs, filters, and outputs.

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 17, 2022, 4:23am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/32 "2022-02-17T04:23:53Z")

</div>

@Badger I checked this command in my nginx.conf file, the output was:

```auto
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
[INFO] 2022-02-17 10:16:03.234 [main] runner - Starting Logstash {"logstash.version"=>"7.16.2", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 11.0.13+8 on 11.0.13+8 +indy +jit [linux-x86_64]"}
[WARN] 2022-02-17 10:16:03.503 [LogStash::Runner] multilocal - Ignoring the 'pipelines.yml' file because modules or command line options are specified
[INFO] 2022-02-17 10:16:04.041 [LogStash::Runner] Reflections - Reflections took 57 ms to scan 1 urls, producing 119 keys and 417 values
[WARN] 2022-02-17 10:16:04.940 [LogStash::Runner] plain - Relying on default value of `pipeline.ecs_compatibility`, which may change in a future major release of Logstash. To avoid unexpected changes when upgrading Logstash, please explicitly declare your desired ECS Compatibility mode.
[WARN] 2022-02-17 10:16:04.985 [LogStash::Runner] beats - Relying on default value of `pipeline.ecs_compatibility`, which may change in a future major release of Logstash. To avoid unexpected changes when upgrading Logstash, please explicitly declare your desired ECS Compatibility mode.
[WARN] 2022-02-17 10:16:05.138 [LogStash::Runner] plain - Relying on default value of `pipeline.ecs_compatibility`, which may change in a future major release of Logstash. To avoid unexpected changes when upgrading Logstash, please explicitly declare your desired ECS Compatibility mode.
[WARN] 2022-02-17 10:16:05.174 [LogStash::Runner] elasticsearch - Relying on default value of `pipeline.ecs_compatibility`, which may change in a future major release of Logstash. To avoid unexpected changes when upgrading Logstash, please explicitly declare your desired ECS Compatibility mode.
Configuration OK
[INFO] 2022-02-17 10:16:05.195 [LogStash::Runner] runner - Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash

```

I didn't see that I have any critical or syntax errors here. I only saw that it was ignoring pipelines.yml file, does it main problem? Or I have another problem that I couldn't see.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 17, 2022, 6:00pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/33 "2022-02-17T18:00:56Z")

</div>

> [@Dark\_Man](#):
>
> I only saw that it was ignoring pipelines.yml file, does it main problem?

No, that's not a problem if you _want_ to use the -f option. I suggested using --config.debug --log.level debug, not --config.test\_and\_exit.

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 18, 2022, 6:33am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/34 "2022-02-18T06:33:44Z")

</div>

@Badger I used the command --config.debug --log.level debug as you said, and do I need to wait until this command finish process? And what is this command do? What is purpose of it?

---

<div class="post-metadata">

**Author:** ![gillranjeett](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gillranjeett](https://discuss.elastic.co/u/gillranjeett)\
**Post date:** [February 18, 2022, 9:38am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/35 "2022-02-18T09:38:36Z")

</div>

I have the same issue. Any tips for solution?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 18, 2022, 5:27pm UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/36 "2022-02-18T17:27:37Z")

</div>

> [@Dark\_Man](#):
>
> And what is this command do? What is purpose of it?

When you run logstash with --config.debug --log.level debug it will print the actual value of path.settings that it is using, which I think may be different to the value you expect, meaning it is not loading the logstash.yml you are editing.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2022, 3:20am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/38 "2022-02-21T03:20:49Z")

</div>

One of the debug messages will contain the value of path.settings that it is using. You need to see if that is set to the directory that contains logstash.yml

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2022, 3:41am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/40 "2022-02-21T03:41:27Z")

</div>

If you used the options I suggested (--config.debug --log.level debug) then you should get dozens of messages from the logstash.runner class

> [2022-02-20T22:38:48,414][DEBUG][logstash.runner] \*path.settings: "/etc/logstash" (default: "/usr/share/logstash/config")  
> [2022-02-20T22:38:48,414][DEBUG][logstash.runner] \*path.logs: "/var/log/logstash" (default: "/usr/share/logstash/logs")  
> [2022-02-20T22:38:48,414][DEBUG][logstash.runner] xpack.monitoring.enabled: false

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 21, 2022, 3:48am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/42 "2022-02-21T03:48:13Z")

</div>

@Badger I found it:

```auto
[DEBUG] 2022-02-21 09:21:58.631 [LogStash::Runner] runner - path.settings: "/usr/share/logstash/config"
[DEBUG] 2022-02-21 09:21:58.631 [LogStash::Runner] runner - path.logs: "/usr/share/logstash/logs"
[DEBUG] 2022-02-21 09:21:58.631 [LogStash::Runner] runner - xpack.monitoring.enabled: false

```

After I checked it by this path:

```auto
cat /usr/share/logstash/config
cat: /usr/share/logstash/config: No such file or directory

```

And there is no such config file.  
so see that path.settings are placed here: /usr/share/logstash/config. So what I need to do next?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2022, 4:01am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/43 "2022-02-21T04:01:24Z")

</div>

OK, let's go back to the beginning ... you were trying to change the log.level in logstash.yml, and you say you edited a file called that.

logstash is trying to read logstash.yml from /usr/share/logstash/config, which does not exist. On the command line you can set --path.settings to the directory in which you were editing your logstash.yml.

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 21, 2022, 4:08am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/44 "2022-02-21T04:08:58Z")

</div>

@Badger where can I set on the command line --path.settings to the directory in which you were editing your logstash.yml? Sorry, I didn't understand clearly what you mean.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2022, 4:11am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/45 "2022-02-21T04:11:14Z")

</div>

You said you edited logstash.yml, if the path to that is /home/user/foo/logstash.yml then add `--path.settings /home/user/foo` to the command line. If it is /tmp/logstash.yml then add `--path.settings /tmp`

---

<div class="post-metadata">

**Author:** ![Dark\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dark_man/32/99119_2.png) [@Dark\_Man](https://discuss.elastic.co/u/Dark_Man)\
**Post date:** [February 21, 2022, 4:28am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/46 "2022-02-21T04:28:37Z")

</div>

Ok, my logstash.yml placed at /etc/logstash, so at which command that I need to add to command line `--path.settings /etc/logstash/logstash.yml`?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 21, 2022, 4:44am UTC](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706/47 "2022-02-21T04:44:07Z")

</div>

No, it points to a directory. Try `--path.settings /etc/logstash`.

[Previous page](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706.md?page=1)

[Next page](https://discuss.elastic.co/t/pipeline-error-pipeline-id-main-exception-nomethoderror-undefined-method-close-for-nil-nilclass/296706.md?page=3)
