# Issues with NMap Codec/NMAP File Ingest

**URL:** <https://discuss.elastic.co/t/issues-with-nmap-codec-nmap-file-ingest/155623>\
**Category:** Logstash\
**Created:** [November 6, 2018, 8:50pm UTC](https://discuss.elastic.co/t/issues-with-nmap-codec-nmap-file-ingest/155623 "2018-11-06T20:50:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 6, 2018, 8:50pm UTC](https://discuss.elastic.co/t/issues-with-nmap-codec-nmap-file-ingest/155623/1 "2018-11-06T20:50:03Z")

</div>

I have some saved NMAP scans that I am trying to ingest. When using the nmap codec ingesting .nmap files, the below error is generated in the logstash log. **Question 1: Can someone explain what the error indicates or where I am going wrong?** I have a feeling the nmap codec is meant for streaming data and not saved files.

`[filewatch.readmode.handlers.readfile]`controlled\_read: general error reading file`{"path"=>"D:/ElasticStack/Ingest/NMap/ELResultsAzure.xml", "error"=>"#<NoMethodError: undefined method`' for nil:NilClass\>", "backtrace"=\>["D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/ruby-nmap-0.8.0/lib/nmap/xml.rb:99:in `scanner'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-codec-nmap-0.0.21/lib/logstash/codecs/nmap.rb:40:in`decode'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.6/lib/logstash/inputs/file/patch.rb:6:in `accept'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-codec-multiline-3.0.10/lib/logstash/codecs/identity_map_codec.rb:178:in`accept'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.6/lib/logstash/inputs/file\_listener.rb:36:in `accept'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.6/lib/filewatch/read_mode/handlers/read_file.rb:38:in`block in controlled\_read'", "org/jruby/RubyArray.java:1734:in `each'", "D:/ElasticStack/Apps/Logstash/6.4.1/vendor/bundle/jruby/2.3.0/gems/logstash-input-file-4.1.6/lib/filewatch/read_mode/handlers/read_file.rb:37:in`block in controlled\_read'"]}`

Attempting to work around this issue, I am ingesting the files and then using the XML Filter in conjunction with XPaths to get the data parsed. However, I am running into a problem where some fields are populated with an array of values. This leads me to **Question 2: When an xpath matches multiple nodes and populates an array of values, is there a way to enumerate over the field and split it into separate values?** For example, if xpath node /root/sub contains anywhere from 1-10 child nodes called host, is there something that will split that value out and write to subfields of host?

---

<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:** [December 4, 2018, 8:50pm UTC](https://discuss.elastic.co/t/issues-with-nmap-codec-nmap-file-ingest/155623/2 "2018-12-04T20:50:08Z")

</div>

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