mirror of
https://github.com/iSharkFly-Docs/opensearch-docs-cn
synced 2025-03-09 14:38:01 +00:00
1.8 KiB
1.8 KiB
layout | title | parent | nav_order |
---|---|---|---|
default | Send events to Opensearch | Logstash | 220 |
Send events to Opensearch
You can send Logstash events to an Opensearch cluster and then visualize your log data with Kibana.
Make sure you have Logstash, Opensearch, and Kibana installed. {: .note }
Opensearch output plugin
To run the Opensearch output plugin, add the following configuration in your pipeline.conf
file:
output {
opensearch {
hosts => "https://localhost:9200"
user => "admin"
password => "admin"
index => "logstash-logs-%{+YYYY.MM.dd}"
ssl_certificate_verification => false
}
}
Sample walkthrough
-
Open the
config/pipeline.conf
file and add in the following configuration:input { stdin { codec => json } http { host => "127.0.0.1" port => 8080 } } output { opensearch { hosts => "https://localhost:9200" user => "admin" password => "admin" index => "logstash-logs-%{+YYYY.MM.dd}" ssl_certificate_verification => false } }
-
Start Logstash:
$ bin/logstash -f config/pipeline.conf --config.reload.automatic
config/pipeline.conf
is a relative path to thepipeline.conf
file. You can use an absolute path as well. -
Add a JSON object in the terminal:
{ "amount": 10, "quantity": 2}
-
Open Opensearch and search for the processed event:
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