To clarify, any action data in a transaction will go into log storage, the smart contract determines if it will also put it in RAM or not.
The decision to store information RAM is typically determined by what type of information is.
Information like..
- Calculated numbers, e.g. Your EOS balance.
- Number of votes for something
- Likes/Dislikes count.
Would typically be stored in RAM, data like a social media comments would not be.
This is because a social media comment "Omg, this is so funny!" means nothing to a computer and does not need to be held so closely in RAM.
This type of decision between RAM storage or not naturally happens because RAM costs! Unlike CPU and Bandwidth which you get back, you don't get RAM back in the same sense, therefore dApp developers are forced to be minimal on the amount of data they put into RAM, what user will want to create a post if it's going to cost them $5 in RAM each time?
Data held in RAM is accessible really fast for any computer, let alone beefy Block Producer nodes. Because of this, your EOS token or any token balance is held in RAM. That way when someone sends you 5 tokens, it's already got your balance held in RAM ready to add 5 tokens onto your balance. EOS wouldn't be able to go as fast as it does, if it had to calculate's peoples balances by going through all their tx history to work out their balances and check for overspending.
Data placed into purely the log is inaccessible to the contract.
To utilise information placed purely into the log, Block Ones Demux can be used. Using this, you can serve content from your own centralised server to end users with data built from the decentralised EOSIO chain.