Try this order:
EMS2: record localstreamname=record_stream chunklength=900 pathtofile=/home/username/temp/recording.mp4 type=mp4 keepalive=0 overwrite=0
EMS1: pushstream uri=rtmp://user:password@XXX.XXX.XX.XX/live targetstreamname=record_stream localstreamname=1234
EMS1: pullstream uri=rtsp://192.168.1.10:554/livestream localstreamname=1234
Notice that I changed the targetstreamname to avoid confusion.