DevSecOps Course Labs

Lab Solution

Bulk load the logs

Make a POST request to the index's _bulk endpoint:

curl -H 'Content-Type: application/json' -XPOST 'localhost:9200/logs/_bulk' --data-binary '@data/logs.json'

Count of successful requests

Successful requests have a log message containing the phrase Fulfilment completed.

You can match just on the word completed as it isn't used in any other log entries:

curl -H 'Content-Type: application/json' 'localhost:9200/logs/_search?size=0&pretty' --data-binary '@labs/elasticsearch/lab/queries/match-completed.json'

There are 30 matches (in the field hits.total.value)

Request ID for the one error which was not a document service problem

Logs with the error level mostly have a message containing the phrase document service unavailable:

curl -H 'Content-Type: application/json' http://localhost:9200/logs/_search?pretty --data-binary '@labs/elasticsearch/lab/queries/match-error.json'

The request ID is 32441751.


Back to the exercises.