If an option expires Out-of-the-Money, the Realized P&L can be found in the closing transaction line in the Trades section of your Activity Statement available in Client Portal. If an option is exercised or assigned into the underlying contract, the Unrealized P&L of the option becomes part of the Cost Basis of the delivered position and is found in the Cost Price in the Open Positions section of your Activity Statement. The Realized P&L of the option will then be included in the closing stock transaction's Realized P&L.
Create an Activity Statement with "Lot Details" and click on the closing option transaction in the Trades section to see the Cost Basis of the closed option. That amount will be added or subtracted from the "T.Price" trade price of the delivered stock. Look in the Open Positions section to review the stock position's Cost Basis for the day it was assigned or exercised into your account, and the stock will now include the closed option's premium.
Find more information on how to create a custom statement with lot details in the IBKR Knowledge Base.