Yes, it is safe for those files to be deleted.
When Portal for ArcGIS is upgraded, a folder named upgrade-backup is created in the arcgisportal folder:
Default location on Windows:
Default location on Linux:
The arcgisportal folder may be in a custom location depending on the installation configuration.
This directory contains version-specific folders with backed-up contents. From Section 2 of the Perform an upgrade of your portal deployment documentation, it is recommended to move that folder to another location to save disk space.
The upgrade-backup folder contains multiple log4j files under /update-backup/<release>/dsdata/elasticsearch_#.#.#/lib. It is safe for those to be deleted.