# Logstash-codec-nmap undefined Method'\[\]'

**URL:** <https://discuss.elastic.co/t/logstash-codec-nmap-undefined-method/280517>\
**Category:** Logstash\
**Created:** [August 5, 2021, 9:46am UTC](https://discuss.elastic.co/t/logstash-codec-nmap-undefined-method/280517 "2021-08-05T09:46:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![111401](https://avatars.discourse-cdn.com/v4/letter/1/e19b73/32.png) [@111401](https://discuss.elastic.co/u/111401)\
**Post date:** [August 5, 2021, 9:46am UTC](https://discuss.elastic.co/t/logstash-codec-nmap-undefined-method/280517/1 "2021-08-05T09:46:26Z")

</div>

Hi,  
I saved my nmap scan output as a xml file as well use a file input and logstash-codec-nmap to decode, also i use the filter and direct output into elasticsearch just like the following configuration  
[logstash-codec-nmap/logstash\_nmap.conf at master · logstash-plugins/logstash-codec-nmap (github.com)](https://github.com/logstash-plugins/logstash-codec-nmap/blob/master/examples/elasticsearch/logstash_nmap.conf)  
but the output as follow

```auto
[ERROR] 2021-08-05 17:34:37.672 [[main]<file] grow - read_to_eof: general error reading /tmp/nmap-log.xml {"error"=>"#<NoMethodError
: undefined method `[.]' for nil:NilClass>", "backtrace"=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/ruby-nmap-0.8.0/lib/nm
ap/xml.rb:99:in `scanner'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-codec-nmap-0.0.21/lib/logstash/codecs/nmap.
rb:40:in `decode'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-beats-6.0.9-java/lib/logstash/inputs/beats/pa
tch.rb:9:in `accept'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/delegate.rb:83:in `method_missing'"]}

```

it seems like something '' is undefined and I have searched for while and find some people have same problem but there's no answer, pls if anyone could help.

Many thanks,  
Noel

---

<div class="post-metadata">

**Author:** ![111401](https://avatars.discourse-cdn.com/v4/letter/1/e19b73/32.png) [@111401](https://discuss.elastic.co/u/111401)\
**Post date:** [August 10, 2021, 9:33am UTC](https://discuss.elastic.co/t/logstash-codec-nmap-undefined-method/280517/2 "2021-08-10T09:33:20Z")

</div>

Have found the reason is something wrong with my nmap argument,  
send nmap.xml to logstash through http according this :

```auto
nmap -A 192.168.0.0/24 -oX - | curl -H "x-nmap-target: local-subnet" http://192.168.0.45:8000 -d @-

```

[NMAP codec - HTTP gives a 500 status when using the codec on an http input but 200 status without the codec · Issue #13 · logstash-plugins/logstash-codec-nmap (github.com)](https://github.com/logstash-plugins/logstash-codec-nmap/issues/13)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 7, 2021, 9:33am UTC](https://discuss.elastic.co/t/logstash-codec-nmap-undefined-method/280517/3 "2021-09-07T09:33:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
