A kind of audit function implementation method based on history order
Technical field
The present invention relates to server info technical field, specifically a kind of practical, based on the audit function implementation method of history order.
Background technology
Along with the development of IT field technology, conventional informationization service and the increasingly powerful stability requirement of cloud computing service to server more and more higher.As server product provider, a server all needs to carry out various test to product in development or production phase, and be find the problem of product thus the quality of this product of strict guarantee as testing authentication department prime responsibility.In test process, we can run into some problems, sometimes may be our some improper operations of carrying out and cause, in order to problem can more rapidly and efficiently be located, we need the process to we perform to carry out record, can navigate to very soon when going wrong the end be product itself existing problems or our operation causes, because problems really exists in our practical operation, and be easy to cause temporal waste and delay.
Based on this, now provide a kind of audit function implementation method based on history order, the method, by calling the history function carried in the Linux system that uses in testing, is checked and its operational order recorded is realized the quick position to product problem.
But sometimes time point also can have effect very much for the location of problem, self-definedly in history order a kind ofly can to log in when performing user, time, execution and use the information such as IP thus the function realizing audit seems particularly important by record order under this demand, thus in the present invention, the record of above-mentioned information is also realized by shell script.
Summary of the invention
Technical assignment of the present invention is for above weak point, provide a kind of practical, based on the audit function implementation method of history order.
Based on an audit function implementation method for history order, its specific implementation process is:
One, Log deposit position is created;
Two, path, file permission is revised;
Three, add shell-command and come into force, carrying out archive operations;
Four, when there is doubtful problem, the log that viewing command performs;
Five, will reduce by associative operation before, search problem reason;
Six, when problem still exists, repeat aforesaid operations and continue to search other reason.
Described file permission comprises root user right and general user's authority.
The shell-command of described interpolation comprises execution content, the archive operations information of execution time.
Described shell-command adds to/etc/profile in, and perform source/etc/profile and make it to come into force.
A kind of audit function implementation method based on history order of the present invention, has the following advantages:
A kind of audit function implementation method based on history order of this invention can log in information such as using IP when performing user, time, execution by record order, by use script on history self-defined go out we test some paid close attention to key messages, as the execution time, perform user etc. to add, and generate log file so that staff can check at any time, thus contribute to manufacturer can be quicker when orientation problem; Accurate positioning, practical, debugging efficiency is high, and debugging content is comprehensive, applied widely, is easy to promote.
Accompanying drawing explanation
Accompanying drawing 1 is realization flow figure of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the invention will be further described.
Linux system carry history function for we furnish us with exectorial historical record, but because it is that basic information sometimes goes orientation problem also to lack the information of some necessity for us, the invention provides a kind of audit function implementation method based on history order, the method by use script on history self-defined go out we test some paid close attention to key message (execution time, perform user etc.) add, and we generate log file so that can check at any time, so that we are in the inquiry carrying out associative operation that goes wrong, thus assist our orientation problem.As shown in Figure 1, its specific implementation process is:
One, Log deposit position is created;
Two, path, file permission is revised;
Three, add shell-command and come into force, carrying out archive operations;
Four, when there is doubtful problem, the log that viewing command performs;
Five, will reduce by associative operation before, search problem reason;
Six, when problem still exists, repeat aforesaid operations and continue to search other reason.
Described file permission comprises root user right and general user's authority.
The shell-command of described interpolation comprises execution content, the archive operations information of execution time.
Described shell-command adds to/etc/profile in, and perform source/etc/profile and make it to come into force.
The core content of described shell script is:
export PROMPT_COMMAND='{ z=$(history 1 | { read x y; echo $y; }); echo -n $(date "+%c") :: $z ::; who am i; } >> $HOME/.history-timestamp'。
The present invention realizes the exectorial audit of operating system by using SHELL script edit, and encounter problems for test process and carry out assistant analysis, the method also can surpass very important effect in system routine maintenance procedure simultaneously.
Above-mentioned embodiment is only concrete case of the present invention; scope of patent protection of the present invention includes but not limited to above-mentioned embodiment; claims of any a kind of audit function implementation method based on history order according to the invention and any person of an ordinary skill in the technical field to its suitable change done or replacement, all should fall into scope of patent protection of the present invention.