Change output files if test fails

Hello,
Is it possible to change output filenames (report.html, log.html, output.xml) not by command line parameters, but from inside the*.robot file?

I want to save reports only if test fails. I would like to change output filenames in the “Test Teardown” keyword, in the Settings section.

No, it is not possible to change the filename during test execution.