Logstash - input/process/output XMLs to ElasticSearch - Java OutputStream

Hello,

I was wondering if there is a way to configure logstash as following:

  • Java application sends a longer XML file by OutputStream to Logstash.
  • Logstash "listens" over this outStream to receive, process and store it in ElasticSearch.

Many thanks.

Regards,
Paco.

You mean something to transform XML to JSON (what elasticsearch speaks)?

I think you can try this filter:

https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html

It should do the job!

Many thanks ebuildy,

No, I mean to be "listening" from Logstash any event in a opened OutputStream in Java. I don't want to read from Files, I want to read from outputStream that comes from Java -> Get it by Logstash -> Process it by XML plugin (as you told me before) -> Store it by ElasticSearch.

So, my question is about the first "connection": between my Java application and Logstash input plugin, if there is a plugin which reads streams from a Java Application.

Many thanks.

Regards,
Paco.

Logstash has some input plugins:

  • TCP
  • HTTP
  • UDP
  • RabbitMQ
  • File

And filter

  • XML

And output:

  • ElasticSearch

From your Java, you can communicate with LogStash via TCP or HTTP easily I am sure. If you want HA, use a queue like RabbitMQ or Kafka between Java and LogStash.

Many thanks :slightly_smiling: