A 230VAC to 18VAC transformer feeding a rectifier. Add a small capacitor and bleeder resistor and you will have exactly what you want. Plus you get the necessary safety isolation from the transformer.
If you can't get the 18 Volt transformer, use a 24 Volt one and use a resister divider to get the top end voltage you want.
Hmm that is good if you have single input channel.But in my application I have 14 inputs & 14 outputs.
My plan is to use PC817 optocoupler feeding 230V AC via 220K resister & a series diode & the optocoupler output (collector resister) feeding via a 24V DC supply & getting Vout from emitter side.
No, the time constant RC is too short. You will need something more like this. Even here, the tradeoff is how much sag you can tolerate during each half-cycle vs how long after the AC turns off the input drops to a logic zero?
Do you really need 14 inputs? If the mains is what you are monitoring and it fails then it will affect all 14 channels, so you could get away with 1 input and 14 outputs.