How to Send logstash logs directly to elastic?

Hi all

Can we send logstash logs directly to elastic?.
Currently it sits under logs folder as physical .log files

Is there any way we can do so?

Hi @rkhapre,

Yes you can send logs directly to in elasticsearch using logstash configuration file you need to create one config file for send the data into elasticsearch

following is an example:
test.conf:

input
{
file
{
path => "/usr/share/logstash/bin/file.log" #Your Log File Path
}
}

output
{
elassticsearch
{
hosts => ["YOUR ELASTICSEARCH IP:9200"]
index => "test"
}
stdout{}
}

if you are using x-pack in Elastic Stack then you have to mention in this elasticsearch{ user => username and password => password}.

then run this using ./logstash -f test.conf

Thanks & Regards,
Krunal.

1 Like

Hi,

As i mentioned, i need to send this directly to ES

With your conf file, first i am flushing the log files physically to a log folder and then streaming it to ES.

I am looking for solution wherein , i dont output the log file, but the logs should stream directly to ES. This i want to do, to avoid unnecessary Disk Space

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