Technical Tip: Automated configuration backups with variable names based on the date
Description | This article describes how to configure automation stitch settings to generate configuration files with different names based on the date the script triggers. |
Scope | FortiGate v6.4.9+ and v7.0.2+GA releases, v7.2.4. |
Solution |
 The following script will be triggered daily at 20:00 (according to the time configured on FortiGate). Â
Â
The command given in the script can be modified for different file transfer methods.
TFTP: SFTP:
                Or:   For more information, refer to: Technical Tip: How to configure Automation Stitches for Multi VDOM for automated Firewall configuration backup Â
 Â
 Μy_Config_Name2022-08-19  Note 2: In v7.2.4, %%date%% and %%time%% do not work as expected in an automation stitch. Use %%log.date%% and %%log.time%% instead. Executing the command directly from the FortiGate CLI will not function as intended. It will only work when triggered through the automation stitch.
  Note 3: %%time%% or %%log.time%% not working for some of the TFTP/SFTP/FTP servers as it analyzed as bad characters for the title.  Here is the output:  ![]()  Note 4: To check if the backup configuration is working with variables (date/ time) needs to be done using automation stitch only and does not change the variables if checking from CLI console or SSH.  Due to Windows limitations, the Windows FTP server will not allow file saves with ':' in them for automation stitch with variable date and time, therefore it will only save the configuration file name with variable date.  Note 5: FortiSwitches also support automation stitches. However, prior to versions 7.4.7 and 7.6.2, the variable '%%date%%' was not processed correctly. As a result, the stitch would not complete and backups would not be created. This behavior was fixed in the aforementioned versions and the feature is now available to be used. See the release notes about bug ID 1117174 under Resolve Issues.  Related articles: Technical Tip: Automatic backup and precautions using date variables |

