In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you WINDOWS Event log daily backup Scripts script example analysis, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
one。 Practice:
First of all, the scripts consists of the following three files
1. Dump_eventlog.cmd-- > this Scripts is used to save eventlog Dump as a full-text file txt.
2. Dumpel.exe-- > this is a tool program, because if you use the export eventlog function built in windows, the resulting file name is .evt, and it will be a code if you open it with the text editing tool, and you must use windows's event checker to see it, which is too shocking, so we can use this program with the last scripts to export a log file named .txt, which is much more convenient to view!
3. Del_eventlog.vbs-- > this scripts is written in wsh editor, and its function is to clear the eventlog records of the system. Someone wants to check, we are not going to share the log why we need this one to delete!
Did you say that when you didn't know what to say? We need to share our daily system Log files, so we use this scripts to empty the system Log after 12:59 midnight every day, so that our daily eventlog will be a whole day, instead of log shares mixed together every day!
two。 Code is clear
Next, I'm going to explain the method of Daiyuan.
1. Dump_eventlog.cmd
-Source code-
@ echo Off
Mkdir DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%
@ echo * start Backup Eventlog *
Dumpel-s 127.0.0.1-l system-f% DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%/system.log
Dumpel-s 127.0.0.1-l application-f% DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%/application.log
Dumpel-s 127.0.0.1-l security-f% DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%/security.log
@ echo * Finish Backup Eventlog *
Star / min del_eventlog.vbs
-
Xianming:
The code does not contain the upper and lower lines. The second line is that we are going to create a folder named by the date.
Since windows's date crawl date change will be Wednesday, 2005-02-23, the slash (/) or sign (-) in it is used as an option symbol for the command line, which may cause errors.
The easiest way here is to use the charging function of environmental variables. With% DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%, we can grab the date in the format of 2006-10-20. Line 4-6 is to use dumpel this program to load three log records of security, application, and system to the txt file to the folder named by the day date. Ip I use the local computer, please change it to your own host ip according to your own needs. Star / min del_eventlog.vbs this line is to clear the log record of the system after sharing, because we have already checked it before! Just copy the above source code and save it as a .bat or .cmd file name!
2. Del_eventlog.vbs
-Source code-
'delete Evenlog
StrComputer= "."
Set objWMIService = GetObject ("winmgmts:" _
& "{impersonationLevel=impersonate, (Backup)}!\" & _
StrComputer & "\ root\ cimv2")
Dim mylogs (3)
Mylogs (1) = "application"
Mylogs (2) = "system"
Mylogs (3) = "security"
For Each logs in mylogs
Set colLogFiles=objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='" & logs& "'")
For Each objLogfile in colLogFiles
ObjLogFile.ClearEventLog ()
Next
Next
-
Xianming:
The code does not contain the upper and lower lines. This is the wsh editor scripts of the emptying system eventlog, so there is no more introduction here. If you have any fun, you can take a look at the microblog example web site, which has a lot of introduction to wsh and sample files to study below!
The above is all the contents of the article "sample Analysis of WINDOWS Event log Daily backup Scripts script". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.