In #22948 we added a deprecation warning when using .date on a long field. However, since scripts run in a reduced permission environment, the underlying call to log the message results in a security manager exception. We need to do this in a doPrivileged block.
See https://discuss.elastic.co/t/painless-script-appender-deprecation-rolling-java-security-accesscontaccess-denied/117313