Log retrieval endpoints in the REST API


Retrieve logs to search and analyze them. 

GET
Get list of fields
Request URL
https://<Your BMC Helix Portal URL>/logs-service/api/v1.0/logs/mapping
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/mapping
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

Successful response

List of available fields is returned.

Unsuccessful responses

Unable to log on to BMC Helix Log Analytics

Contact BMC Support.

Response codes

Code

Message

Description

200

JSON that includes list of fields

Successfully received all the fields.

401

Authentication has failed

Verify JWT.

500

Unable to connect to server.

No fields are received. Contact BMC Support.

POST

Search logs

You can search logs by sending single or multiple queries.

Request URL
https://<Your BMC Helix Portal URL>/logs-service/api/v1.0/logs/msearch
Example request URL
https://HostA.bmc.com/logs-service/api/v1.0/logs/msearch
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>  
Request body
{
  valid JSON queries in the ndjson format
}
Example - request body
{"size":10,"query":{"bool":{"filter":[{"range":{"@timestamp":{"gte":"2021-07-26T08:00:22Z","lte":"2021-07-26T08:41:22Z"}}}]}}}
{"size":10,"query":{"bool":{"filter":[{"match":{"message":"NullPointerException"}},{"range":{"@timestamp":{"gte":"2021-07-26T08:00:22Z","lte":"2021-07-26T08:41:22Z"}}}]}}}
{"size":10,"query":{"match":{"status":"500"}}}

Successful response

Search result is returned.

Unsuccessful responses

Scenario 1: Unable to log on to BMC Helix Log Analytics

Contact BMC Support.

Scenario 2: Incorrect request body

Ensure that the query is correct.


Troubleshooting

Issue: Long response time

Reason: The payload response size is more than 20 MB.

Workaround: Optimize the query or reduce the time period of query.


Response codes

Code

Message

Description

200

Details of query results returned, like total, skipped, failed, and successful records.

Search result is returned.

400

Bad request.

Verify request header, JSON format of the query, and request body.

401

Authentication has failed

Verify JWT.

500

Unable to connect to server.

No records are received. Contact BMC Support.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*