bpaquet / node-logstash

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

Unable to use grok pattern within a configuration file #121

Closed jerome83136 closed 8 years ago

jerome83136 commented 8 years ago

Hello,

I'm trying to use grok patterns within a configuration file.

I try to launch node-logstash this way:

./bin/node-logstash-agent --log_level=info --config_file=/conf/logstash/logstash.dc.conf

My configuration file (/conf/logstash/logstash.dc.conf) follows:

input {
 #zaf1
 file {
  start_index => 0
  path => "/central_logs/input/prod/webservers/zaf1/ihs/prospectMA/access_log"
 }
}

filter {
 grok {
  match => '%{IP}'
 }
}

output {
 file {
  path => "/central_logs/output/prod/webservers/dc/dc.node-logstash.log"
 }
}

But when I launch node-logstash; I get this error:

[Tue, 19 Apr 2016 12:50:14 GMT] INFO Changing log_level info
[Tue, 19 Apr 2016 12:50:14 GMT] NOTICE Starting node-logstasth-agent 0.0.5
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Max http socket 100
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Loading config file : /conf/logstash/logstash.dc.conf
[Tue, 19 Apr 2016 12:50:14 GMT] INFO File loaded, 3 urls found
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Loading config : 6 urls
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Initializing output file
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Start output to file /central_logs/output/prod/webservers/dc/dc.node-logstash.log
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Initializing filter AddHost
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Initializing filter AddTimestamp
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Initializing filter AddVersion
[Tue, 19 Apr 2016 12:50:14 GMT] INFO Initializing filter Grok
[Tue, 19 Apr 2016 12:50:14 GMT] ERROR Unable to load urls from command line
[Tue, 19 Apr 2016 12:50:14 GMT] ERROR Error: You have to specify grok in url ?match=%25%7BIP%7D
    at FilterGrok.<anonymous> (/products/node-logstash-0.0.5/lib/lib/base_component.js:183:27)
    at Object.async.eachSeries (/products/node-logstash-0.0.5/node_modules/async/lib/async.js:145:20)
    at FilterGrok.BaseComponent.loadConfig (/products/node-logstash-0.0.5/lib/lib/base_component.js:173:9)
    at FilterGrok.BaseFilter.init (/products/node-logstash-0.0.5/lib/lib/base_filter.js:14:8)
    at LogstashAgent.configure (/products/node-logstash-0.0.5/lib/agent.js:133:12)
    at LogstashAgent.<anonymous> (/products/node-logstash-0.0.5/lib/agent.js:196:10)
    at iterate (/products/node-logstash-0.0.5/node_modules/async/lib/async.js:149:13)
    at /products/node-logstash-0.0.5/node_modules/async/lib/async.js:160:25
    at LogstashAgent.<anonymous> (/products/node-logstash-0.0.5/lib/agent.js:244:5)
    at LogstashAgent.<anonymous> (/products/node-logstash-0.0.5/lib/agent.js:201:7)

What am I doing wrong ?

Thank for your help

Best regards Jérôme

bpaquet commented 8 years ago

Pb between doc and code. Thx you for reporting it.

bpaquet commented 8 years ago

And let me know if some feature is missing, I can probably add it easily.

jerome83136 commented 8 years ago

Hi, Many thanks for your quick reply and glad to be able to help ;-)

I guess the fix will be available after the next commit ?

If you are OK; I will create a new post with a wish-list for node-logstash

I know that you are working on it on your spare time, so I understand that all these evolution may not be done, and probably not in the next few weeks :)

But if I can help node-logstash to become even mode better, it will be nice.

Best regards Jérôme