Logstash-codec-nmap undefined Method'[]'

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)
but the output as follow

[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

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

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)

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