bpaquet / node-logstash

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

"Cannot call method 'match' of null" when using file input #64

Closed reezer closed 10 years ago

reezer commented 10 years ago

Obviously file input can be null instead of a string. This appears to happen when a process starts writing to it. I am using the current state of the master branch.

Wed, 23 Apr 2014 14:21:06 GMT] ERROR TypeError: Cannot call method 'match' of null
    at Filter.filter (/path/node-logstash/lib/lib/file_filter.js:9:19)
    at InputFile.monitorFile (/path/node-logstash/lib/inputs/input_file.js:29:54)
    at InputFile.<anonymous> (/path/node-logstash/lib/inputs/input_file.js:97:12)
    at FSWatcher.EventEmitter.emit (events.js:117:20)
bpaquet commented 10 years ago

Can you provide the config ?

reezer commented 10 years ago

These are pasted. Only user, applicationname (logfile) and hostname have been modified.

input://file:///home/user/application.log
output://tcp://log.example.com:2311
bpaquet commented 10 years ago

Hi,

Sorry for the delay. I'm not able to reproduce the bug. Do you have more information ? Do you have the error when starting node-logstash ? When you create the log file ?

Regards,

Bertrand

bpaquet commented 10 years ago

I reproduce the problem with a node 0.8.x under max os x. Is it your case ?

Regards

reezer commented 10 years ago

It's FreeBSD here, so really close.

bpaquet commented 10 years ago

Ok. I add a warning in log. I can not do better, because it's the fs.watch NodeJS Api which does not provide all information. This API is not consistent between different operating system. Are you using a recent NodeJS version ? Can you try with the last 0.11 one ? Which version of FreeBSD are you using ?

bpaquet commented 10 years ago

Please see https://github.com/bpaquet/node-logstash/commit/3de435fbbc7368bd014d25f8f33f3a83b612d489

bpaquet commented 10 years ago

I have tested, the NodeJS API does not provide all informations under FreeBSD 10.

I'm afraid I can not solve your issue :( You can submit an issue to NodeJS.