Search code examples
javas4sdk

Getting Corelation id in logs


I have created an application of SAP Springboot archetype and published it to SAP Cloud foundry and can see the corelation id being generated in the Kibana Logs.

But I was not able to retrieve the CorelationId. I wanted this generated corelation id to be passed from the publisher to consumer through RabbitMQ.

I have tried a lot but I couldn't succeed. Please let me know how to get this Id?


Solution

  • I think this is not possible given that the ID is generated by SAP Cloud Platform when writing the log file. The SDK offers the ErrorResponseBuilder class to generate a reference ID when an exception is thrown in the application to have a reference ID both on the API level (error response) and in the log file. This aims to avoid the exposure of internal application information to the API. But I think this is not exactly what you are aiming for, so you may have to generate an identifier by yourself and bring it to the log.