CN108984118A - A kind of log information saving method and system based on openwrt system flash subarea - Google Patents

A kind of log information saving method and system based on openwrt system flash subarea Download PDF

Info

Publication number
CN108984118A
CN108984118A CN201810671882.2A CN201810671882A CN108984118A CN 108984118 A CN108984118 A CN 108984118A CN 201810671882 A CN201810671882 A CN 201810671882A CN 108984118 A CN108984118 A CN 108984118A
Authority
CN
China
Prior art keywords
log information
catalogue
flash subarea
subarea
openwrt
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.)
Pending
Application number
CN201810671882.2A
Other languages
Chinese (zh)
Inventor
劳逸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Jiji Intellectual Property Operation Co ltd
Original Assignee
Sichuan Feixun Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Sichuan Feixun Information Technology Co Ltd filed Critical Sichuan Feixun Information Technology Co Ltd
Priority to CN201810671882.2A priority Critical patent/CN108984118A/en
Publication of CN108984118A publication Critical patent/CN108984118A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of log information saving method and system based on openwrt system flash subarea, comprising: S1. adds at least one for saving spare flash subarea of log information;S2. it creaties directory, and will be under the spare flash subarea carry to the catalogue;S3. by the log information preservation under the catalogue;S4. the size that log information in the catalogue is periodically or non-periodically detected using finger daemon deletes the old log information of preset quantity when the log information is more than preset value.The present invention have it is easy to use, and can long-term preservation log information, be convenient for later maintenance the advantages that.

Description

A kind of log information saving method and system based on openwrt system flash subarea
Technical field
The present invention relates to embedded device field more particularly to a kind of log letters based on openwrt system flash subarea Cease store method and system.
Background technique
Based on the equipment of openwrt system, such as router, in the exploitation debugging stage, it is often necessary to check the log of system (log) information is debugged, but existing openwrt system equipment can not all save log information mostly, and equipment restarts rear log Information is emptied, and very big difficulty is caused to the debugging efforts of research and development of software personnel.
It, will when breaking down if the log information of equipment can be saved in equipment test phase or after selling Very big convenience is brought to the maintenance and upgrade of equipment, research staff is not needed and repeatedly reappears problem, checks log information.
In order to solve the above-mentioned technical problem, people have carried out long-term exploration, such as Chinese patent discloses a kind of Linux Log Administration System and method [application number: 201611262883.9], a kind of resource-sharing and data based on linux server The method of backup [application number: 201610320927.2] and [apply by a kind of method for obtaining the log of Linux virtual machine internal Number: the patents such as 201510790808.9], aforementioned three schemes are required to through external server, and log could be obtained by connecting equipment Information, structure is complicated, inconvenient for use, and needs the cooperation of external equipment, and when equipment is not under user's usage scenario, user may not Equipment can be made to connect upper external server, cause log information that can not obtain;In addition, third scheme can only obtain the same day Log information, information in a device still can not long-term preservation, restart if there is equipment, important log information will be lost, Difficulty is brought for later maintenance debugging.
Summary of the invention
Regarding the issue above, the present invention provides it is a kind of be capable of long-term preservation log information based on openwrt system The log information saving method for flash subarea of uniting;
The another object of this programme is to provide a kind of log based on openwrt system flash subarea based on the above method Information preservation system.
In order to achieve the above objectives, present invention employs following technical proposals:
A kind of log information saving method based on openwrt system flash subarea, comprising:
S1. at least one is added for saving the spare flash subarea of log information;
S2. it creaties directory, and will be under the spare flash subarea carry to the catalogue;
S3. by the log information preservation under the catalogue.
In the above-mentioned log information saving method based on openwrt system flash subarea, in step sl, constructing The spare flash subarea is added when the flash subarea of system, and it is named.
In the above-mentioned log information saving method based on openwrt system flash subarea, each spare flash The size of subregion is at least 320M.
In the above-mentioned log information saving method based on openwrt system flash subarea, in step s 2, pass through life " mkdir/ directory name " is enabled to create the catalogue, and the title that the entitled catalogue of the catalogue is named.
In the above-mentioned log information saving method based on openwrt system flash subarea, in step s 2, use The mount tool of linux is by under the spare flash subarea carry to the catalogue, and the carry order is " mount-t The spare flash subarea position/directory name of file system type/dev/ ", the title that the entitled catalogue of catalogue is named.
In the above-mentioned log information saving method based on openwrt system flash subarea, the file system type For jffs2, in step s 2, by spare flash subarea under jffs2 file system type carry to the catalogue.
In the above-mentioned log information saving method based on openwrt system flash subarea, step S3 is specifically included:
The log information is recorded using syslog mechanism, and by the log information preservation under the catalogue.
In the above-mentioned log information saving method based on openwrt system flash subarea, also wrap after step s 3 It includes:
S4. the size that log information in the catalogue is periodically or non-periodically detected using finger daemon, when the log information When more than preset value, the old log information of preset quantity is deleted.
A kind of log information preservation system based on openwrt system flash subarea, comprising:
Partition creating module, for adding at least one for saving the spare flash subarea of log information;
Directory creating module, for createing directory;
Carry module, being used for will be under the spare flash subarea carry to the catalogue;
Preserving module is used for the log information preservation under the catalogue.
Further include guarding module in the above-mentioned log information preservation system based on openwrt system flash subarea, uses In the size for periodically or non-periodically detecting log information in the catalogue, when the log information is more than preset value, delete default The old log information of quantity.
The present invention has the advantage that 1, the independent flash subarea of addition compared to the prior art, protects for log information It deposits, log information will not be lost when restarting equipment and recovery factory parameter, facilitate research and development of software personnel positioning;2, real The function that log information management system can reach long-term preservation log independent of external server is showed;3, due to independent of The equipment such as external server, avoid the occurrence of, and under user's usage scenario, log information can not be saved by not connecting external server, When equipment fault can not orientation problem, realize equipment no matter under that usage scenario, log information can be saved, for setting The stability of standby later maintenance, equipment provides a great help, and at the same time having, building is simple, convenient and efficient etc. excellent Point;4, equipment uses in user hand, or when progress test for a long time, can be good at the log information for saving use process, It facilitates equipment and carries out problem when something goes wrong;5, periodic detection and it can quantify and delete log information, guarantee newest log letter Breath has memory space.
Detailed description of the invention
Fig. 1 is the method flow diagram of the embodiment of the present invention one;
Fig. 2 is the method flow diagram when embodiment of the present invention one has finger daemon;
Fig. 3 is the system structure diagram of the embodiment of the present invention two.
Appended drawing reference: partition creating module 1;Directory creating module 2;Carry module 3;Preserving module 4;Guard module 5.
Specific embodiment
Although operations are described as the processing of sequence by flow chart, many of these operations can by concurrently, Concomitantly or simultaneously implement.The sequence of operations can be rearranged.Processing can be terminated when its operations are completed, It is also possible to have the additional step being not included in attached drawing.Processing can correspond to method, function, regulation, subroutine, son Program etc..
Term "and/or" used herein above includes any of associated item listed by one of them or more and institute There is combination.When a unit referred to as " connects " or when " coupled " to another unit, can be connected or coupled to described Another unit, or may exist temporary location.
Term used herein above is not intended to limit exemplary embodiment just for the sake of description specific embodiment.Unless Context clearly refers else, otherwise singular used herein above "one", " one " also attempt to include plural number.Also answer When understanding, term " includes " and/or "comprising" used herein above provide stated feature, integer, step, operation, The presence of unit and/or component, and do not preclude the presence or addition of other one or more features, integer, step, operation, unit, Component and/or combination thereof.
The equipment that the present invention is applied to openwrt system, such as router solve and debug rank in exploitation in the prior art Section, can not save log information, and equipment, which restarts rear log information and is emptied, leads to problems such as staff's work difficulty increase, below It is the preferred embodiment of the present invention and in conjunction with attached drawing, technical scheme of the present invention will be further described, but the present invention is unlimited In these embodiments.
Embodiment one
As described in Figure 1, the present embodiment is based on problem of the prior art, proposes a kind of based on openwrt system flash subarea Log information saving method, comprising:
S1. at least one is added for saving the spare flash subarea of log information;
S2. it creaties directory, and will be under the spare flash subarea carry to the catalogue;
S3. by the log information preservation under the catalogue.
Preferably, in step sl, the present embodiment addition quantity is one, and is added in the flash subarea of the system of building Add spare flash subarea to be used to save log information, and spare flash subarea is named, for example, being named here For permanent.
Preferably, the size of each spare flash subarea is all larger than or is equal to 5 block, i.e., at least 320M, when So, the size of each spare flash subarea can be adjusted voluntarily according to actual needs, but be to be able to smooth carry to mesh Under record, each spare flah subregion has to be larger than 320M.
Further, in step s 2, the catalogue is created by order " mkdir/ directory name ", and the catalogue is entitled The title that the catalogue is named, also, catalogue is named as permanent_config here, then, foregoing command is just answered It should are as follows: mkdir/permanent_config.
Specifically, in step s 2, using the mount tool of linux by the spare flash subarea carry to the mesh Under record, and the carry order is " the spare flash subarea position/directory name of mount-t file system type/dev/ ", described The title that the entitled catalogue of catalogue is named;The file system type is jffs2, in step s 2, by spare flash points Area is under jffs2 file system type carry to the catalogue.
For example, used here as mtdblock2 district location, then carry order should are as follows: mount-t jffs2/dev/ mtdblock2/permanent_config。
Further, step S3 is specifically included:
The log information is recorded using syslog mechanism, and by the log information preservation under the catalogue, in addition, this Embodiment reads log information using logread order, and is created under the catalogue of step S2 creation, that is to say, that under catalogue File be stored directly in spare flash subarea, that is, be stored in flash, be stored in flash memory due to not being, so Even if restarting equipment, log information will not lose, due to being not held in rootfs datas subregion, so even if restoring Default setting will not delete log information, realize the function of persistence log information.
As shown in Figure 2, it is preferable that in order to avoid log information is excessive, after step s 3 further include:
S4. the size that log information in the catalogue is periodically or non-periodically detected using finger daemon, when the log information When more than preset value, the old log information of preset quantity is deleted.
The present embodiment is described in detail underneath with concrete scene:
1, when constructing the flash subarea of openwrt system, a spare flash subarea is added, is named as Permanent, flash subarea information is as follows, is classified as spare flash subarea information where mtd2:
2, it is named as the catalogue of permanent_config using order mkdir/permanent_config creation, is ordering Enable row is lower to check equipment using ls, the catalogue created is as follows:
3, using the mount tool of linux, permanent subregion is mounted to jffs2 file system type/ Under permanent_config catalogue, carry order are as follows: mount-t jffs2/dev/mtdblock2/permanent_ Config, system carry situation is as follows, and last line indicates by permanent subregion carry to permanent_config Catalogue:
4, using syslog mechanism record log information, be stored in/permanent_config catalogue under, use later Log information is read in logread order, and be created on/permanent_config catalogue under;
5, a finger daemon is created, timing detects the size of log information, when more than permanent partition size When 80%, 50% old log information is deleted, avoids log information excessive, while retaining newest log information.
The method of the present embodiment by the way that log information preservation to be realized to the function of long-term preservation log information in flash, and And the management system of log information does not depend on and external server, avoids the occurrence of under user's usage scenario without taking outside connection Be engaged in device, can not save log information, when equipment fault, can not orientation problem, realize equipment no matter under which kind of usage scenario, Log information can be saved, the stability of the later maintenance for equipment, equipment provides a great help.
Embodiment two
As shown in figure 3, present embodiment discloses a kind of log information preservation systems based on openwrt system flash subarea System, comprising:
Partition creating module 1, for adding at least one for saving the spare flash subarea of log information;Specifically It says, for adding a spare flash subarea when constructing flash subarea to be used to save log information, and to spare flash Subregion is named;
Directory creating module 2, for createing directory, the catalogue is for placing spare flash subarea;
Carry module 3, being used for will be under the spare flash subarea carry to the catalogue;
Preserving module 4 is used for the log information preservation under the catalogue.
Further, a little systems of the present embodiment further include guarding module 5, for periodically or non-periodically detecting in the catalogue The size of log information deletes the old log information of preset quantity when the log information is more than preset value.Preset value can be The 80% of spare flash subarea, preset quantity can be the 50% of whole log information, and make relatively old part information.
Specific embodiment described herein is only to give an example to the present invention.The technical field of the invention Technical staff can make various modifications or additions to the described embodiments or be substituted in a similar manner, but Without departing from the spirit of the invention or going beyond the scope defined by the appended claims.
In addition, although partition creating module 1 is used more herein;Directory creating module 2;Carry module 3;Save mould Block 4;The terms such as module 5 are guarded, but it does not exclude the possibility of using other terms.The use of these items is only for more square Just describing and explaining essence of the invention and being construed as any additional limitation is disagreed with spirit of that invention Back.

Claims (10)

1. a kind of log information saving method based on openwrt system flash subarea characterized by comprising
S1. at least one is added for saving the spare flash subarea of log information;
S2. it creaties directory, and will be under the spare flash subarea carry to the catalogue;
S3. by the log information preservation under the catalogue.
2. the log information saving method according to claim 1 based on openwrt system flash subarea, feature exist In in step sl, adding the spare flash subarea in the flash subarea of the system of building, and be named to it.
3. the log information saving method according to claim 2 based on openwrt system flash subarea, feature exist In the size of each spare flash subarea is at least 320M.
4. the log information saving method according to claim 1 based on openwrt system flash subarea, feature exist In in step s 2, by order " mkdir/ directory name " creation catalogue, and the entitled catalogue of the catalogue is named Title.
5. the log information saving method according to claim 1 based on openwrt system flash subarea, feature exist In, in step s 2, using the mount tool of linux by under the spare flash subarea carry to the catalogue, and it is described Carry order is " the spare flash subarea position/directory name of mount-t file system type/dev/ ", and the catalogue is entitled described The title that catalogue is named.
6. the log information saving method according to claim 5 based on openwrt system flash subarea, feature exist In the file system type is jffs2, in step s 2, by spare flash subarea with jffs2 file system type carry Under to the catalogue.
7. the log information saving method according to claim 1 based on openwrt system flash subarea, feature exist In step S3 is specifically included:
The log information is recorded using syslog mechanism, and by the log information preservation under the catalogue.
8. the log information saving method according to claim 1 based on openwrt system flash subarea, feature exist In after step s 3 further include:
S4. the size that log information in the catalogue is periodically or non-periodically detected using finger daemon, when the log information is more than When preset value, the old log information of preset quantity is deleted.
9. a kind of log information preservation system based on openwrt system flash subarea characterized by comprising
Partition creating module (1), for adding at least one for saving the spare flash subarea of log information;
Directory creating module (2), for createing directory;
Carry module (3), being used for will be under the spare flash subarea carry to the catalogue;
Preserving module (4) is used for the log information preservation under the catalogue.
10. the log information preservation system according to claim 9 based on openwrt system flash subarea, feature exist In, further include guarding module (5), for periodically or non-periodically detecting the size of log information in the catalogue, when the log believe When breath is more than preset value, the old log information of preset quantity is deleted.
CN201810671882.2A 2018-06-26 2018-06-26 A kind of log information saving method and system based on openwrt system flash subarea Pending CN108984118A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810671882.2A CN108984118A (en) 2018-06-26 2018-06-26 A kind of log information saving method and system based on openwrt system flash subarea

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810671882.2A CN108984118A (en) 2018-06-26 2018-06-26 A kind of log information saving method and system based on openwrt system flash subarea

Publications (1)

Publication Number Publication Date
CN108984118A true CN108984118A (en) 2018-12-11

Family

ID=64538858

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810671882.2A Pending CN108984118A (en) 2018-06-26 2018-06-26 A kind of log information saving method and system based on openwrt system flash subarea

Country Status (1)

Country Link
CN (1) CN108984118A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467516A (en) * 2010-11-04 2012-05-23 北京北方微电子基地设备工艺研究中心有限责任公司 Method, device and system for recording logs in equipment control process
US20120317348A1 (en) * 2008-02-05 2012-12-13 Spansion Llc Mitigate flash write latency and bandwidth limitation
CN106649068A (en) * 2016-12-28 2017-05-10 福建三元达网络技术有限公司 System fault log recording method and system
CN107479922A (en) * 2017-08-04 2017-12-15 深圳市中兴物联科技有限公司 A kind of flash data management method, device and computer-readable recording medium
CN107506149A (en) * 2017-08-29 2017-12-22 郑州云海信息技术有限公司 System management memory journal dump method and device
CN107918568A (en) * 2017-11-13 2018-04-17 北京全路通信信号研究设计院集团有限公司 A kind of method for preventing linux system from restarting failure

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120317348A1 (en) * 2008-02-05 2012-12-13 Spansion Llc Mitigate flash write latency and bandwidth limitation
CN102467516A (en) * 2010-11-04 2012-05-23 北京北方微电子基地设备工艺研究中心有限责任公司 Method, device and system for recording logs in equipment control process
CN106649068A (en) * 2016-12-28 2017-05-10 福建三元达网络技术有限公司 System fault log recording method and system
CN107479922A (en) * 2017-08-04 2017-12-15 深圳市中兴物联科技有限公司 A kind of flash data management method, device and computer-readable recording medium
CN107506149A (en) * 2017-08-29 2017-12-22 郑州云海信息技术有限公司 System management memory journal dump method and device
CN107918568A (en) * 2017-11-13 2018-04-17 北京全路通信信号研究设计院集团有限公司 A kind of method for preventing linux system from restarting failure

Similar Documents

Publication Publication Date Title
JP4321705B2 (en) Apparatus and storage system for controlling acquisition of snapshot
CN104487960B (en) Automated disaster recovery and Data Migration
US7716185B2 (en) Creation of a single client snapshot using a client utility
US8024292B2 (en) Creation of a single snapshot using a server job request
JP5021929B2 (en) Computer system, storage system, management computer, and backup management method
US7523278B2 (en) Backup and restore operations using a single snapshot
US7549028B2 (en) Backup and restore operations using a single snapshot driven by a server job request
US9262282B2 (en) System and method for synchornisation of data and recovery of failures during synchronization between two systems
WO2017107900A1 (en) Virtual machine recovery method and virtual machine management device
WO2000045259B1 (en) Pre-defined hardware and software bundle ready for database applications
JPH11134117A (en) Computer system
CN101566959A (en) Using volume snapshots to prevent file corruption in failed restore operations
CN109558318B (en) Code management method and code warehouse distributed system
Stockinger et al. Grid Data Management in action: Experience in running and supporting data management services in the EU Datagrid Project
CN101286886B (en) Method and device to recover configuring information of network appliance
CN102880530B (en) Terminal and terminal backup and restoration methods
CN113330426B (en) Method, device and system for backing up data
CN109408282B (en) Application program backup recovery method and device and computer readable storage medium
US7801859B1 (en) Tracking filesystem backups
CN101631042A (en) Method and system for realizing data backup restoration of heterogeneous network management systems
CN111158952B (en) Method for automatically backing up configuration files by using external storage device
CN108984118A (en) A kind of log information saving method and system based on openwrt system flash subarea
US7890793B1 (en) Techniques for restoring file system resources
CN100550744C (en) The method that network element device is configured
WO2017005125A1 (en) Temporary file management method for use in operating system or application program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190415

Address after: 201616 No. 3666 Sixian Road, Songjiang District, Shanghai

Applicant after: PHICOMM (SHANGHAI) Co.,Ltd.

Address before: 610100 125 Longquan Street Park Road, Longquanyi District, Chengdu, Sichuan.

Applicant before: Sichuan fixun Information Technology Co.,Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201112

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Applicant before: Phicomm (Shanghai) Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181211