---
title: "Elastic logstash"
description: "Integrate Elastic Logstash agent with Middleware to collect and forward logs efficiently."
section: "Third Party Agents"
breadcrumb: "Third Party Agents > Elastic Logstash"
canonical: "https://docs.middleware.io/get-started/agent/elastic-logstash"
---
# Elastic logstash

Middleware supports the ingestion of logs from [Elastic Logstash](https://www.elastic.co/logstash).

> **Note:** Middleware currently supports ingesting logs from Logstash in the JSON format.

> **Note:** Filebeats agent is currently not supported.

## Prerequisites

Logstash agent should already be installed on your machine.

## Logstash Configuration

Open your [Logstash pipeline configuration](https://www.elastic.co/docs/reference/logstash/config-setting-files) file (usually located in `/etc/logstash/conf.d` directory on Linux platform) and add the following filter and output configuration as described below:

```json
filter {
    ruby {
        init => "
          require 'socket'
          @@hostname = Socket.gethostname
        "
        code => "event.set('host.id', @@hostname)
                 event.set('mw.account_key','your-initial-token')
                "
    }
}

output{
   http {
     Format => "json"
     Http_method => "post"
     headers => {
       "Content-Type" => "application/json"
     }

     Url => "https://<uid>.middleware.io/logstash"
   }
}
```

Once this configuration is added, restart the Logstash. You should now see logs in the logs section of your Middleware account.
