Sending Logs

Quick Start

Now, you get a brand new OpenSearch endpoint, and you want to make sure you can send logs to it. Please follow the steps below.

  • Create an accounts.json file with 2 bank accounts
cat > accounts.json << EOF
{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"2"}}
{"account_number":2,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
EOF
cat accounts.json
  • Bulk load accounts.json into OpenSearch
curl -u sauron:mypassword \
-X POST \
-H 'Content-Type: application/x-ndjson' --data-binary @accounts.json \
https://elasticsearch.handu-phx.handu.developers.oracledx.com/bank/_bulk?pretty
  • Verify both bank accounts are available for search
curl -u sauron:mypassword https://elasticsearch.handu-phx.handu.developers.oracledx.com/bank/_search?pretty
...
  "hits" : {
    "total" : 2,
  • If you see 2 hits like shown above, then congratulations, your OpenSearch endpoint is ready for prime!!!
Using FluentBit to send logs to OpenSearch

Please refer to FluentBit documentation for more details