Get secret after transaction is withdrawn

Whenever the HTLC is consumed (by claiming the funds) how do we get the secret ? Is it included in the tx ?

The secret pre-image is in the argument given to the LogicSig.

You should be able to find it using Indexer v2.
Use for example to get the transaction. Then, the hash should be transaction.signature.logicsig.args: