I want to send logs from my local node.js application and I used this https://github.com/log4js-node/logstashHTTP.
But the examples that the documentation mention send logs directly to elasticsearch (I'm able to see the logs using kibana locally) and not to logstash( which I've configured as below ) which is what i want.
input {
beats {
port => 5044
}
tcp {
port => 5000
add_field => { "name" => "usage"}
}
tcp {
port => 6000
add_field => { "name" => "logs"}
codec => json
}
}
output {
if [name] == "usage"
{
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "usage-%{+YYYY-MM-dd}"
}
}
if [name] == "logs"
{
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "logs-%{+YYYY-MM-dd}"
}
}
}
How to confiure the log4js in the node application to send logs to logstash(on ports 5000 or 6000) which in turn sends it to elasticsearch after some filters and transformations that I will add later. Any leads appreciated. Thanks!
Edit: I think there is some configuration error with me using the http appender. Is this why the problem comes? I've set tcp logstash receiver but i'm sending using http one? Even if it is i don't know how to configure log4js for tcp logstash receiver On the log4js github repo tcp is not mentioned HERE .Any leads with this are also great!