2021-07-06 02:52:45 -04:00
---
layout: default
2021-07-07 02:51:45 -04:00
title: Ship events to OpenSearch
2021-07-06 02:52:45 -04:00
parent: Logstash
nav_order: 220
---
2021-07-07 02:51:45 -04:00
# Ship events to OpenSearch
2021-07-06 02:52:45 -04:00
2021-07-07 02:51:45 -04:00
You can Ship Logstash events to an OpenSearch cluster and then visualize your events with OpenSearch Dashboards.
2021-07-06 02:52:45 -04:00
2021-07-06 14:53:10 -04:00
Make sure you have [Logstash ]({{site.url}}{{site.baseurl}}/logstash/index/#install-logstash-on-mac--linux ), [OpenSearch ]({{site.url}}{{site.baseurl}}/opensearch/install/index/ ), and [OpenSearch Dashboards ]({{site.url}}{{site.baseurl}}/dashboards/install/index/ ).
2021-07-06 02:52:45 -04:00
{: .note }
2021-07-07 02:51:45 -04:00
## OpenSearch output plugin
2021-07-06 02:52:45 -04:00
2021-07-07 02:51:45 -04:00
To run the OpenSearch output plugin, add the following configuration in your `pipeline.conf` file:
2021-07-06 02:52:45 -04:00
```yml
output {
opensearch {
hosts => "https://localhost:9200"
user => "admin"
password => "admin"
index => "logstash-logs-%{+YYYY.MM.dd}"
ssl_certificate_verification => false
}
}
```
## Sample walkthrough
1. Open the `config/pipeline.conf` file and add in the following configuration:
```yml
input {
stdin {
codec => json
}
}
output {
opensearch {
hosts => "https://localhost:9200"
user => "admin"
password => "admin"
index => "logstash-logs-%{+YYYY.MM.dd}"
ssl_certificate_verification => false
}
}
```
2021-07-07 02:52:32 -04:00
This Logstash pipeline accepts JSON input through the terminal and ships the events to an OpenSearch cluster running locally. Logstash writes the events to an index with the `logstash-logs-%{+YYYY.MM.dd}` naming convention.
2021-07-07 02:51:45 -04:00
2021-07-06 02:52:45 -04:00
2. Start Logstash:
```bash
$ bin/logstash -f config/pipeline.conf --config.reload.automatic
```
`config/pipeline.conf` is a relative path to the `pipeline.conf` file. You can use an absolute path as well.
3. Add a JSON object in the terminal:
```json
{ "amount": 10, "quantity": 2}
```
2021-07-07 02:51:45 -04:00
4. Start OpenSearch Dashboards and choose **Dev Tools** :
2021-07-06 02:52:45 -04:00
```json
GET _cat/indices?v
health | status | index | uuid | pri | rep | docs.count | docs.deleted | store.size | pri.store.size
green | open | logstash-logs-2021.07.01 | iuh648LYSnmQrkGf70pplA | 1 | 1 | 1 | 0 | 10.3kb | 5.1kb
```