bpaquet / node-logstash

Simple logstash implmentation in nodejs : file log collection, sent with zeromq
Other
517 stars 141 forks source link

Exception: [TypeError: ip.indexOf is not a function] #129

Closed jerome83136 closed 2 years ago

jerome83136 commented 8 years ago

Hello,

After starting node-logstash, I have seen this in my logs:

Exception has been catch, it' a bug Please submit an issue on https://github.com/bpaquet/node-logstash Exception: [TypeError: ip.indexOf is not a function] TypeError: ip.indexOf is not a function at FilterGeoip.process (/products/node-logstash/lib/filters/filter_geoip.js:92:8) at FilterGeoip. (/products/node-logstash/lib/lib/base_filter.js:21:24) at emitOne (events.js:77:13) at FilterGeoip.emit (events.js:169:7) at FilterRegex. (/products/node-logstash/lib/agent.js:248:14) at emitOne (events.js:77:13) at FilterRegex.emit (events.js:169:7) at FilterRegex. (/products/node-logstash/lib/lib/base_filter.js:27:18) at emitOne (events.js:77:13) at FilterRegex.emit (events.js:169:7)

So I have submitted this issue. Hope it will help.

Best regards Jérôme

bpaquet commented 8 years ago

What contains your ip field ? An array ? A hash ? The geoip filter expect a

string.

Bertrand

On Mon, Jun 20, 2016 at 4:12 PM, jerome83136 notifications@github.com wrote:

Hello,

After starting node-logstash, I have seen this in my logs:

Exception has been catch, it' a bug Please submit an issue on https://github.com/bpaquet/node-logstash Exception: [TypeError: ip.indexOf is not a function] TypeError: ip.indexOf is not a function at FilterGeoip.process (/products/node-logstash/lib/filters/filter_geoip.js:92:8) at FilterGeoip. (/products/node-logstash/lib/lib/base_filter.js:21:24) at emitOne (events.js:77:13) at FilterGeoip.emit (events.js:169:7) at FilterRegex. (/products/node-logstash/lib/agent.js:248:14) at emitOne (events.js:77:13) at FilterRegex.emit (events.js:169:7) at FilterRegex. (/products/node-logstash/lib/lib/base_filter.js:27:18) at emitOne (events.js:77:13) at FilterRegex.emit (events.js:169:7)

So I have submitted this issue. Hope it will help.

Best regards Jérôme

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bpaquet/node-logstash/issues/129, or mute the thread https://github.com/notifications/unsubscribe/AAUk3dZtKPyCxLw9XM1of8vD9u1KnHdGks5qNp_kgaJpZM4I5vS2 .

jerome83136 commented 8 years ago

On Elasticsearch the "clientip" field if mapped as an "IP" field:

"clientip": {
            "index": "analyzed",
            "type": "ip"
          },

The logstash config is:

 geoip {
  field => clientip
  cache_size => 1000
 }

Please notice there are GeoIP fields (clientip) which are working fine.

Example of a field successfully indexed in Easticsearch : clientip 159.50.252.42

The problem does not seem to occur for each line of log.

Jérôme

bpaquet commented 8 years ago

The clientip should not contains a string. I can ensure the field is a string. That will remove the exception. But the interesting point is what is it if it's not a string ? Any idea ?