How to store @timestamp in UNIX_MS instead of ISO date format

I do not think that is possible. If you do something like

    ruby { code => "event.set('epoch', ((event.get('@timestamp').to_f*1000).to_i).to_s)" }
    mutate { remove_field => [ "@timestamp" ] }
    mutate { rename => { "epoch" => "@timestamp" } }

It will raise an exception, because the code expects @timestamp to be a LogStash::Timestamp. You have to use a different field name.