06-15-2026 01:03 PM - edited 07-27-2026 11:22 AM
Hello,
Amid my studies I came across the following assignment:
The applet must be triggered whenever someone exits configuration mode in a terminal session.
This requirement applies to terminal sessions on cty and on vty lines.
The applet must use CLI commands to achieve the following:
First, the applet must append the current time and date and the current startup configuration to a file in flash.
In this virtual environment, you have to use the unix keyword to identify the router flash file system. The name of the file should be config-changes,
so use unix:config-changes to specify the destination file.
Then, the applet must save the running configuration to NVRAM. Use the command write memory to save the configuration; do not use the command copy running-config startup-config.
Finally, the applet must append the newly saved startup configuration to the unix:config-changes file.
And next to my suggested solution, I was wondering whether there other ways to set up an EEM to accomplish the same goal.
Thanks.
event manager applet save-and-log
event syslog pattern "SYS-5-CONFIG_I"
action 1.0 cli command "enable"
action 2.0 cli command "show clock | append unix:config-changes"
action 3.0 cli command "show startup-config | append unix:config-changes"
action 4.0 cli command "write memory"
action 5.0 cli command "show startup-config | append unix:config-changes"
!
! Testing
SRV1#telnet 10.1.1.1
Trying 10.1.1.1 ... Open
R1#cpnf
R1#conf
R1#configure term
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#end
R1#exit
[Connection to 10.1.1.1 closed by foreign host]
SRV1#
! Verify at R1:
R1#
R1#more unix:config-changes | inc ^! L
! Last configuration change at 11:32:20 PST Mon Jun 15 2026
! Last configuration change at 11:38:13 PST Mon Jun 15 2026
R1#more unix:config-changes | inc ^\*
% *+ operand could be empty
% Failed to compile regular expression.
R1#
--------------------------
#sh event manager policy registered
No. Class Type Event Type Trap Time Registered Name
1 applet user syslog Off Mon Jun 15 11:31:53 2026 save-and-log
pattern {SYS-5-CONFIG_I}
maxrun 20.000
action 1.0 cli command "enable"
action 2.0 cli command "show clock | append unix:config-changes"
action 3.0 cli command "show startup-config | append unix:config-changes"
action 4.0 cli command "write memory"
action 5.0 cli command "show startup-config | append unix:config-changes"
07-23-2026 05:57 PM
I would think that you could technically use a "Match CLI Pattern" statement for anytime someone writes "End" or "Exit," but this does not necessarily exit the configuration terminal. As such, I would think that configuring the EEM applet to trigger its actions upon the syslog message you provided is sufficient.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide