CN103617283B - A kind of method and device for storing daily record - Google Patents
A kind of method and device for storing daily record Download PDFInfo
- Publication number
- CN103617283B CN103617283B CN201310674858.1A CN201310674858A CN103617283B CN 103617283 B CN103617283 B CN 103617283B CN 201310674858 A CN201310674858 A CN 201310674858A CN 103617283 B CN103617283 B CN 103617283B
- Authority
- CN
- China
- Prior art keywords
- virtual server
- mark
- path
- daily record
- log storage
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0635—Configuration or reconfiguration of storage systems by changing the path, e.g. traffic rerouting, path reconfiguration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0667—Virtualisation aspects at data level, e.g. file, record or object virtualisation
Abstract
The present invention relates to field of computer technology, more particularly to a kind of method and device for storing daily record.This method includes:For the virtual server of daily record to be stored, the mark of the virtual server is obtained from the internal memory of the virtual server corresponding device;The log storage path parameter in the configuration file of path in the mark and the virtual server corresponding device, is the virtual server configuration log store path;The daily record of the virtual server is stored according to the log storage path of configuration.The dynamic configuration of the log storage path of virtual server is the method achieve, daily record storage efficiency is improved.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of method and device for storing daily record.
Background technology
Along with the fast development of computer technology, aim at computer system day in terms of monitoring server system resource should
With receiving much concern.The daily record storage mode of computer system turns into the major issue of influence computer working efficiency.
The method of existing storage daily record includes:Start the virtual server of daily record to be stored;In the virtual server
Configuration log store path in path configuration file in corresponding device;The void is stored according to the log storage path of configuration
Intend the daily record of server.
It is static configuration, it is necessary in daily record to be stored using path configuration file in the method for existing storage daily record
Manual modification log storage path in the path configuration file of virtual server, therefore the method for existing storage daily record, operation
It is complicated and less efficient.
The content of the invention
The present invention provides a kind of method and device for storing daily record, to reduce the complexity of storage daily record, and improves day
Will storage efficiency.
On the one hand, the present invention proposes a kind of method for storing daily record, including:
For the virtual server of daily record to be stored, the void is obtained from the internal memory of the virtual server corresponding device
Intend the mark of server;
The daily record in the configuration file of path in the mark and the virtual server corresponding device stores road
Footpath parameter, is the virtual server configuration log store path;
The daily record of the virtual server is stored according to the log storage path of configuration.
On the other hand, the present invention also proposes a kind of device for storing daily record, including:
Mark acquiring unit, for the virtual server for daily record to be stored, from the virtual server corresponding device
Internal memory in obtain the mark of the virtual server;
Path dispensing unit, text is configured for the path in the mark and the virtual server corresponding device
Log storage path parameter in part, is the virtual server configuration log store path;
Log storage unit, for storing the virtual clothes according to the log storage path of the path configuration of described dispensing unit
The daily record of business device.
The method and device of storage daily record proposed by the present invention, passes through the virtual server of the daily record to be stored in internal memory
Identification information is the virtual server configuration log store path, realizes the dynamic of the log storage path of virtual server
Configuration, improves daily record storage efficiency.
Brief description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the part of the present invention, not
Constitute limitation of the invention.In the accompanying drawings:
Fig. 1 is a kind of implementation process figure of the method for the storage daily record provided in first embodiment of the invention;
Fig. 2 is a kind of structural representation of the device of the storage daily record provided in second embodiment of the invention.
Embodiment
Below in conjunction with the accompanying drawings and specific embodiment to the present invention carry out in further detail with complete explanation.It may be appreciated
It is that specific embodiment described herein is only used for explaining the present invention, rather than limitation of the invention.Further need exist for explanation
It is that for the ease of description, part related to the present invention rather than full content are illustrate only in accompanying drawing.
Fig. 1 is a kind of implementation process figure of the method for the storage daily record provided in first embodiment of the invention.It is of the invention real
Applying the method for example offer can be performed by the device of storage daily record provided in an embodiment of the present invention, and the device can be by software
And/or hardware is realized.As shown in figure 1, method provided in an embodiment of the present invention includes:
Step 101, the virtual server for daily record to be stored, are obtained from the internal memory of the virtual server corresponding device
Take the mark of the virtual server.
Virtual server is also referred to as vps main frames, for true main frame, using special software and hardware technology one
Complete server host is divided into several main frames.Tomcat is conventional virtual server, due to its have technical advance,
The features such as performance is stable and free, it is deep to be liked by Java fans and obtained approving for partial software developer, turn into
Network application server popular at present.
Day in step 102, the path configuration file in the mark and the virtual server corresponding device
Will store path parameter, is the virtual server configuration log store path.
Wherein, the form of path configuration file can be that can expand markup language(Extentsible Markup
Language, XML), for daily record storage format and log storage path etc. in path label configuration file.Due to path configuration
Log storage path parameter in file is made up of identification parameter and default path, by the mark assignment obtained in step 101
To the identification parameter in log storage path parameter, you can to complete the assignment to log storage path.
Step 103, the daily record for storing according to the log storage path of configuration the virtual server.
By the daily record storage of virtual server to the log storage path configured, i.e., daily record storage is stored into road to daily record
In the file of catalogue corresponding to footpath, wherein daily record refer to object specified by system some operations and its operating result on time
Between orderly set.Each journal file is made up of log recording, and every log recording describes once single system event.
Under normal circumstances, system journal is that user can be with the text of direct reading, wherein containing a timestamp and a letter
Other information specific to breath or subsystem.Journal file is the IT resources such as server, work station, fire wall and application software
Correlated activation records necessary, valuable information, and this is highly important to system monitoring, inquiry, form and security audit.
The embodiment of the present invention is obtaining the mark of the virtual server from the internal memory of the virtual server corresponding device
Before knowledge, in addition to:When the virtual server starts, the mark of the virtual server is added to from the virtual clothes
It is engaged in the internal memory of device corresponding device.
Due to being marked in log storage path containing identification parameter, it is necessary to be read from the internal memory of equipment described in virtual server
Information is known with assembling daily record outgoing route, therefore when starting virtual server, is identified and be added in internal memory.
The mark of the virtual server is added to from the internal memory of the virtual server corresponding device, including:It is logical
The startup script of the virtual server is crossed, the mark is added in the internal memory of the virtual server corresponding device, institute
The information for including the mark in the startup script for stating virtual server.
It is by adding mark in the startup script of virtual server that the mark of virtual server, which is added in internal memory,
Information realization.Because the startup script of virtual server includes the information of mark, it can be by the letter of mark when starting
Breath storage is into the internal memory of equipment described in virtual server.
The daily record in the configuration file of path in the mark and the virtual server corresponding device stores road
Footpath parameter, is the virtual server configuration log store path, including:The daily record provided in the log storage path parameter
Under the end catalogue of store path, create with the file of the mark name.
It is substantially that daily record is stored in corresponding to the catalogue of log storage path that daily record, which is stored under log storage path,
File under.Therefore, it will identify after the identification parameter that addition is assigned in log storage path parameter, in log storage path
Under the end catalogue for the log storage path that parameter is provided, create with the file of the mark name.Wherein, daily record storage road
The end catalogue of the log storage path provided in the parameter of footpath is optionally located in the installation kit of virtual server.
Optionally, it is described to identify for uniquely representing the virtual server in the apparatus.It is virtual in the present embodiment
The mark of server can be unique, and the daily record of each identical virtual server in same server is stored respectively in not
With under file, the daily record of each identical virtual server positioned at same server can be now distinguished;In addition, virtual clothes
The mark of business device can be not unique, and the daily record of the virtual server of like-identified is stored in same file folder.
The method for the storage daily record that the embodiment of the present invention is provided, by by the mark of the virtual server in internal memory, adding
It is added in the identification parameter included by the log storage path parameter in the configuration file of path, so that by be stored in internal memory
The identification information of the virtual server of daily record is the virtual server configuration log store path, realizes virtual server
The dynamic configuration of log storage path, improves daily record storage efficiency.
Fig. 2 is a kind of effect structure figure of the log storage provided in second embodiment of the invention.The present invention is implemented
Example belongs to unified design with embodiment of the method in the present invention, for realizing the method in embodiment illustrated in fig. 1, implements in the present invention
The content not being described in detail in the path dispensing unit of example, refer to the inventive method embodiment.As shown in Fig. 2 the embodiment of the present invention
The device of offer, including:
Mark acquiring unit 201, for the virtual server for daily record to be stored, sets from belonging to the virtual server
The mark of the virtual server is obtained in standby internal memory;Path dispensing unit 202, for according to the mark and the void
Intend the log storage path parameter in the path configuration file in server corresponding device, be the virtual server configuration log
Store path;Log storage unit 203, for storing the void according to the log storage path of the path configuration of described dispensing unit
Intend the daily record of server.
The path dispensing unit 202 is specifically for the log storage path that is provided in the log storage path parameter
Under the catalogue of end, create with the file of the mark name.
Device also includes:Adding device is identified, for when the virtual server starts, by the virtual server
Mark is added to from the internal memory of the virtual server corresponding device.
The mark is added to by the mark adding device specifically for the startup script by the virtual server
In the internal memory of the virtual server corresponding device, the information of the mark is included in the startup script of the virtual server.
The mark that the mark acquiring unit is obtained is used to uniquely represent the virtual server in the apparatus.
The device for the storage daily record that the embodiment of the present invention is provided, by mark acquiring unit 201 in virtual server
Start in script and configure virtual server(Such as Tomcat)Identification information, and identification information be stored in internal memory in.Then, road
Identification parameter is added in log storage path parameter by footpath dispensing unit 202, and identification information is assigned into daily record storage road
Identification parameter in the parameter of footpath, to complete the dynamic configuration of log storage path;Log storage unit 203 is deposited in the daily record of configuration
Store up and the corresponding daily record of virtual server is stored under path.
Further, since the startup script that the device for the daily record storage that the embodiment of the present invention is provided passes through virtual server is
Each virtual server is filled with unique mark, so as to realize the mesh of multiple virtual server output journals in a server
Ground be all different files, can be pin-pointed to a log information be come from which virtual server so that application report
The corresponding application of which virtual server that is properly positioned to that can be quickly in the case of mistake malfunctions.
The device for the daily record storage that the present embodiment is provided is used to perform the daily record storage that any embodiment of the present invention is provided
Method, possesses corresponding functional module, reaches identical technique effect.
Third embodiment of the invention is the complete skill scheme for the daily record that tomcat is stored using log4j.Wherein, log4j
The technology commonly used in being stored for daily record, is an open source code project.By using log4j, log information can be controlled defeated
The destination sent is console, file, even gui component, socket server, the logout of new technology
Device or unix syslog finger daemon etc.;The output format of each daily record can also be controlled;By defining each daily record
The rank of information, can more meticulously control the generating process of daily record.When the daily record of log4j technical controllings is stored, it can pass through
One configures neatly to be configured, the code without changing application.
The unique mark of the tomcat information is injected in tomcat startup script, to distinguish on a server
Other tomcat, usual tomcat startup script are Shell scripts.Above-mentioned mark is user oneself definition, it is necessary to ensure
The mark of each tomcat on same server is different, and if any 5 tomcat applications, their mark is respectively
Server1, server2, server3, server4 and server5, increase following in the tomcat of first startup script
Code:
export JAVA_OPTS=”-Dserver.log.id=server1”
When performing the startup order of the tomcat with tomcat startup scripts "-Dserver.log.id=server1 " generals
Can dynamically it be injected into the internal memory of equipment described in the tomcat, such as tomcat java system constants.
Servlet monitor Log4jInitListener is write, the monitor main function is equal to by key
Server.log.id is obtained starts the value server1 that script inputs java system constants previously by tomcat, and group again
The daily record outgoing route of dress is input in java system constants, and specific code fragment is as follows:
Finish writing needs to be configured to monitor in the web.xml of tomcat applications after monitor, and before must necessarily be placed in most
Face, is noted again to apply the very first time in startup to go the value for getting server.log.id to re-assembly daily record outgoing route
Enter into java system constants, occur that log4j configuration files are loaded with and daily record outgoing route is not noted also if putting behind
Situation about entering.Web.xml configuration code fragments are as follows:
<listener>
<listener-class>com.smy.web.interceptor.Log4jInitListener</listener-
class>
</listener>
Monitor Log4jInitListener initializes last code:Log4jWebConfigurer.init-
Logging(event.getServletContext());Main function be initialization log4j, initialization log4j during
Log4j configuration file log4j.xml can be loaded, so that the daily record outgoing route in java system constants is input to
In log4j.xml dynamic configuration, log4j.xml dynamic path configuration code snippet is as follows:
Wherein, the key parameter " key " in the dynamic log path in log4j.xml needs and Log4jInitListener
In the attribute-name of java system constants injected it is identical, otherwise can be because parameter is mismatched and inject failure.
Log4j information is finally initialized in tomcat application programs, calls log4j to carry needing the place of output journal
The application programming interface of confession carries out daily record output operation, and code snippet is as follows:
Configured more than, the log information in code will all be output to the dynamic log path configured in log4j.xml
In file, i.e., in/export/home/tomcat/logs/app/server1/smy-man.log, its on a server
Its each tomcat log path is respectively:
In the present embodiment, the method that distributed system high concurrent dynamical output log information is realized based on log4j technologies can
So that the daily record destination of the tomcat application outputs on a server is all different files, a day can be pin-pointed to
Will information be from which tomcat application, using reporting an error in the case of can be quickly be properly positioned to which tomcat application goes out
Mistake, and reduced to greatest extent to a journal file progress frequently I/O operation under big complications, reduce therefore
The risk that the log information brought is lost and file handle is damaged, enhances the stability and robustness of system.
Upper described only the preferred embodiments of the present invention, are not intended to limit the invention, for those skilled in the art
Speech, the present invention can have various changes and change.All any modifications made within spirit and principles of the present invention, equally replace
Change, improve, should be included in the scope of the protection.
Claims (6)
1. a kind of method for storing daily record, it is characterised in that including:
For the virtual server of daily record to be stored, the virtual clothes are obtained from the internal memory of the virtual server corresponding device
The mark of business device, the mark is used to uniquely represent the virtual server in the apparatus;
Log storage path ginseng in path configuration file in the mark and the virtual server corresponding device
Number, is the virtual server configuration log store path, the log storage path parameter is by identification parameter and default road
Footpath is constituted;
The daily record of the virtual server is stored according to the log storage path of configuration;
Wherein, the daily record in the path configuration file in the mark and the virtual server corresponding device stores road
Footpath parameter, is the virtual server configuration log store path, including:
Under the end catalogue for the log storage path that the log storage path parameter is provided, create with the mark name
File.
2. according to the method described in claim 1, it is characterised in that obtained from the internal memory of the virtual server corresponding device
Before the mark of the virtual server, in addition to:
When the virtual server starts, the mark of the virtual server is added to from belonging to the virtual server and set
In standby internal memory.
3. method according to claim 2, it is characterised in that the mark of the virtual server is added to from the void
In the internal memory for intending server corresponding device, including:
By the startup script of the virtual server, the mark is added to the internal memory of the virtual server corresponding device
In, the information of the mark is included in the startup script of the virtual server.
4. a kind of device for storing daily record, it is characterised in that including:
Mark acquiring unit, for the virtual server for daily record to be stored, out of described virtual server corresponding device
The middle mark for obtaining the virtual server is deposited, the mark is used to uniquely represent the virtual server in the apparatus;
Path dispensing unit, in the path configuration file in the mark and the virtual server corresponding device
Log storage path parameter, be the virtual server configuration log store path, the log storage path parameter is by marking
Know parameter and default path composition;
Log storage unit, for storing the virtual server according to the log storage path of the path configuration of described dispensing unit
Daily record;
Wherein, the path dispensing unit is specifically for the end of the log storage path provided in the log storage path parameter
Hold under catalogue, create with the file of the mark name.
5. device according to claim 4, it is characterised in that described device also includes:
Adding device is identified, for when the virtual server starts, the mark of the virtual server to be added to from institute
In the internal memory for stating virtual server corresponding device.
6. device according to claim 5, it is characterised in that the mark adding device is specifically for by described virtual
The startup script of server, the mark is added in the internal memory of the virtual server corresponding device, the Virtual Service
The information of the mark is included in the startup script of device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310674858.1A CN103617283B (en) | 2013-12-11 | 2013-12-11 | A kind of method and device for storing daily record |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310674858.1A CN103617283B (en) | 2013-12-11 | 2013-12-11 | A kind of method and device for storing daily record |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103617283A CN103617283A (en) | 2014-03-05 |
CN103617283B true CN103617283B (en) | 2017-10-27 |
Family
ID=50167986
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310674858.1A Active CN103617283B (en) | 2013-12-11 | 2013-12-11 | A kind of method and device for storing daily record |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103617283B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103984621B (en) * | 2014-04-01 | 2017-08-11 | 广州杰赛科技股份有限公司 | log separation method and system |
CN104391905A (en) * | 2014-11-17 | 2015-03-04 | 浪潮通用软件有限公司 | Module-division-based attachment path setting method |
CN105657473A (en) * | 2015-11-25 | 2016-06-08 | 乐视云计算有限公司 | Data processing method and device |
CN105488201B (en) * | 2015-12-08 | 2018-09-21 | 北京皮尔布莱尼软件有限公司 | A kind of log inquiring method and system |
CN105681472B (en) * | 2016-03-28 | 2019-04-02 | 微梦创科网络科技(中国)有限公司 | A kind of log transmission method and device |
CN108170578B (en) * | 2018-01-08 | 2021-05-28 | 武汉斗鱼网络科技有限公司 | Log collection method and device |
CN112035331B (en) * | 2020-11-04 | 2021-02-19 | 北京爱奇艺智能科技有限公司 | Log collection method for virtual reality equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006059852A1 (en) * | 2004-12-04 | 2006-06-08 | Electronics And Telecommunications Research Institute | Method and system for providing resources by using virtual path |
CN103200037A (en) * | 2013-04-11 | 2013-07-10 | 深圳市共进电子股份有限公司 | System log (syslog) storing method |
CN103294704A (en) * | 2012-02-28 | 2013-09-11 | 鸿富锦精密工业(深圳)有限公司 | File synchronous system and method |
CN103329129A (en) * | 2011-01-12 | 2013-09-25 | 国际商业机器公司 | Multi-tenant audit awareness in support of cloud environments |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8239493B2 (en) * | 2009-04-21 | 2012-08-07 | International Business Machines Corporation | Automated server controlled client-side logging |
-
2013
- 2013-12-11 CN CN201310674858.1A patent/CN103617283B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006059852A1 (en) * | 2004-12-04 | 2006-06-08 | Electronics And Telecommunications Research Institute | Method and system for providing resources by using virtual path |
CN103329129A (en) * | 2011-01-12 | 2013-09-25 | 国际商业机器公司 | Multi-tenant audit awareness in support of cloud environments |
CN103294704A (en) * | 2012-02-28 | 2013-09-11 | 鸿富锦精密工业(深圳)有限公司 | File synchronous system and method |
CN103200037A (en) * | 2013-04-11 | 2013-07-10 | 深圳市共进电子股份有限公司 | System log (syslog) storing method |
Non-Patent Citations (1)
Title |
---|
"Log4j使用相对路径指定log文件及使用总结";HuanYue;《http://huanyue.iteye.com/blog/574598》;20100119;第1-6页 * |
Also Published As
Publication number | Publication date |
---|---|
CN103617283A (en) | 2014-03-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103617283B (en) | A kind of method and device for storing daily record | |
US10430209B1 (en) | System and method for server customization | |
US10142180B2 (en) | Method and system for providing unified configuration information to disparate system software components | |
US9633106B1 (en) | Log data analysis | |
Marty | Cloud application logging for forensics | |
US8667556B2 (en) | Method and apparatus for building and managing policies | |
US9460169B2 (en) | Multi-tenant audit awareness in support of cloud environments | |
US9170845B2 (en) | Deployed application factory reset | |
US7665098B2 (en) | System and method for monitoring interactions between application programs and data stores | |
US20160021092A1 (en) | System and method for managing heterogeneous computing environments | |
US20130111473A1 (en) | Passive monitoring of virtual systems using extensible indexing | |
US20080243848A1 (en) | User specific logs in multi-user applications | |
Onarlioglu et al. | Privexec: Private execution as an operating system service | |
Dwaraki et al. | GitFlow: Flow revision management for software-defined networks | |
Kälber et al. | Forensic application-fingerprinting based on file system metadata | |
US11307934B1 (en) | Virtual backup and restore of virtual machines | |
US11783049B2 (en) | Automated code analysis tool | |
Davi et al. | Trusted virtual domains on OKL4: Secure information sharing on smartphones | |
Markelov | Certified OpenStack Administrator Study Guide | |
CN104717176A (en) | Access control method, access control system, and server | |
Hall et al. | VMware certified professional data center virtualization on vSphere 6.7 study guide: exam 2V0-21.19 | |
CN113676548B (en) | Micro-service flow switching method, device and medium based on configuration shunt deployment | |
Maiti et al. | Development of remote laboratories using cloud architecture with web instrumentation | |
Anderson et al. | Windows Server 2008 R2 Remote Desktop Services Resource Kit | |
CN106484602B (en) | A kind of configuration data read method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |