# Patent

## Title
File system event tracking

## Abstract

Automated file system event tracking and reporting techniques are described in which file system events requested by a user application are intercepted and recorded prior to the request being permitted to pass to the file system for execution. Similarly, file system responses to a prior captured file system event are also intercepted and recorded. Predefined patterns of file system event may be aggregated and reported as a single event.

## Background
BACKGROUND
The invention relates generally to computer file systems and more particularly, but not by way of limitation, to methods and devices for recording or tracking file system events.
In the context of computer operating systems, a “file” may be defined as a named collection of data. Files are normally retained in storage devices such as magnetic disks (fixed, floppy, and removable), magnetic tape, optical media such as compact disks (“CDs”) and digital video disks (“DVDs”) and semiconductor memory devices such as electrically programmable read-only memory (“EPROM”), electrically erasable programmable read-only memory (“EEPROM”), programmable gate arrays and flash devices.
A “file system” is that portion of an operating system whose primary task is to manage the files retained on one or more storage devices. The file system is the means through which all files are manipulated (e.g., created, destroyed and modified). To aid in this task, file systems retain and/or obtain information about each file, so called “metadata.” Illustrative file metadata include the file's user-specified name, a file identifier (for uniquely identifying the file to the file system), a pointer or reference to the file in non-volatile storage (or main memory), the user ID associated with the file's creation, the time at which the file was created, the user ID associated with the last modification to the file, the time the last modification to the file was made and security information. Illustrative security information includes which specified user group or groups (e.g., administrator, employees and executives) are permitted to read or modify the file. It will be recognized that some, or all, of this metadata may be retained within the file itself.
While prior art file system tracking applications provide some file event tracking capabilities, they do not compress or aggregate file operations for usability or track the user account making a change or detect, identify. Thus, it would be beneficial to provide methods, applications and systems that provide these capabilities.
SUMMARY
Automated file system event tracking and reporting techniques are described in which file system events requested by a user application are intercepted and recorded prior to the request being permitted to pass to the file system for execution. Similarly, file system responses to a prior captured file system event are also intercepted and recorded. Predefined patterns of file system event may be aggregated and reported as a single event.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows, in flowchart format, a file tracking method in accordance with one embodiment of the invention.
FIG. 2 shows a hierarchical directory structure.
FIG. 3 shows, in block diagram format, a file system tracking service in accordance with one embodiment of the invention.
FIG. 4 shows typical file system events associated with file edit operations.



DETAILED DESCRIPTION
Methods and devices to provide real-time tracking of file system events and event aggregation reporting are described. The following description is presented to enable any person skilled in the art to make and use the invention as claimed and is provided in the context of embodiments designed to operate in a Microsoft Windows® environment, variations of which will be readily apparent to those skilled in the art. (MICROSOFT WINDOWS is a registered trademark of the Microsoft Corporation.) Accordingly, the claims appended hereto are not intended to be limited by the disclosed embodiments, but are to be accorded their widest scope consistent with the principles and features disclosed herein.
Referring to FIG. 1, file tracking method 100 in accordance with one embodiment of the invention waits for a file system event to occur (block 105). User-level file system requests are intercepted (block 110) and checked to determine if the request is of a specified type (block 115). If the intercepted request is not of a type that has been specified to be tracked (the “No” prong of block 115), the request is passed to the file system (block 125). If the request is of a type specified to be tracked (the “Yes” prong of block 115), information about the request is recorded (block 120) and then allowed to pass to the file system (block 125). When the file system completes processing the event intercepted during the acts of block 110, its response is intercepted (block 130) and again checked to see if it is of a type specified to be tracked (block 135). If the intercepted response is not associated with a type of file system request that has been specified to be tracked (the “No” prong of block 135), the response is passed to the appropriate application (block 145)—that is, the application making the initial request. If the response is associated with file system request of a type specified to be tracked (the “Yes” prong of block 135), information about the response is recorded (block 140) and then passed to the application that made the initial request (block 145).
Types of file system activity that may be specified by a user include directory and file operations such as create, delete, move, rename, security change, access denied while creating and access denied while opening actions. In an embodiment designed to operate with the Microsoft Windows operating system, these events correspond to the following types of Microsoft defined file system events: IRP_MJ_CREATE; IRP_MJ_SET_INFORMATION; IRP_MJ_READ; IRP_MJ_WRITE; IRP_MJ_SET_SECURITY; IRP_MJ_CLEANUP; and IRP_MJ_CLOSE. In accordance with the invention, a user may specify that one or more of these file system actions be tracked on a per-file, per-directory, per-user group, per-process or per-user identification basis. In addition, all of one or more specified event types may also be tracked (regardless of file, directory, group, process or user identification). It will be recognized that file system event specification may be obtained from a user (e.g., a system administrator) though a graphical user interface (“GUI”) prior to using tracking method 100. And, while the details of the graphical interface may vary from implementation to implementation, preparing such an interface would be well within the skill of one of ordinary skill in the art.
Referring to the acts of blocks 120 (recording file system request information) and 140 (recording file system response information), in one embodiment the following information is recorded: the time the event occurred; the user account identifier (e.g., the security identifier); they type of event (e.g., read, write, modify, create, delete, . . . ); the local path of the affected file object (e.g., a file or directory); the process identifier; the name of the computer system on which the event occurred; and security information. Security information includes both “before” and “after” values. As used herein, a before value corresponds to the security state of an object at the time the file system event request was intercepted in accordance with block 110. Similarly, an after value corresponds to the security state of an object at the time the file system event response was intercepted in accordance with block 130. For example, if a file system event were to change a directory from read/write access to read-only access, both of these security states would be recorded (one designated as the BEFORE state value and one designated as the AFTER state value). In another embodiment, the “difference” between the before and after security states may be recorded instead of separate before and after values. An advantage of this approach is that it provides a baseline to determine how a file system object's security state is changed over time. Accordingly, methods in accordance with the invention permit security change histories to be obtained even if tracking operations are interrupted (e.g., auditing is stopped for a period of time or an event is missed).
In one embodiment both inherited and explicit security changes are tracked. When a security change to a specific file system object is made (e.g., a file or directory), this explicit change is noted and recorded. In addition, if a security change to one object is made (e.g., a directory), that effects the security of hierarchically related objects, these changes are also determined and recorded. By way of example, consider FIG. 2 which shows hierarchical directory structure 200 having root directory 205, child directories 210 and 215, where directory 215 itself has child directory 220. As shown, directory 210 includes file object 225, directory 215 includes file object 230 and directory 220 includes file object 235. Consider a user-specified (explicit) security change to file object 225. Such a change is noted and recorded in accordance with file tracking method 100. Now, consider an explicit security change event directed to directory 215. This (explicit) change would be noted and recorded in accordance with file tracking method 100 and, in addition, if the explicit security change modifies an access right to any hierarchically related object (e.g., directory object 220 and/or file objects 230 or 235), this change too is noted and recorded (i.e., an inherited security change).
Referring to FIG. 3, tracking service 300 in accordance with one embodiment of the invention includes intercept module 305, buffer 310, user-level module 315 and buffer 320. In general, operating system or kernel-mode module 305 intercepts file system requests (e.g., request 325) form user-level applications (e.g., application 330) and files system responses (e.g., response 335) from file system 340. As previously noted, service 300 may be initialized prior to beginning event capture operations so that one or more file system events are specified for tracking. As used herein, a “service” is a collection of one or more code modules that do not require an active user session to execute.
More specifically, intercept module 305 watches all file activity on a given computer system such as, for example, a file server computer system. If an intercepted file system request is identified as being of a type designated for tracking, its information is temporarily stored in buffer 310 after which it is passed to file system 340. Similarly, intercept module 305 watches all file system responses and, if a response is detected that corresponds to a prior stored request, its information is also temporarily stored in buffer 310 after which it is passed to the application making the initial request (e.g., application 325). In one embodiment, user-level module 315 periodically polls buffer 310 to retrieve recently captured file system activity information. In another embodiment, intercept module 305 periodically notifies user-level module 315 that there is event information cached in its buffer 310. In still another embodiment, intercept module 305 causes the contents of buffer 310 to be periodically delivered to user-level module 315. Regardless of which embodiment is actually implemented, after the contents of buffer 310 is obtained by user-level module 315, intercept module 305 may reuse buffer 310.
For convenience, user-level module 315 stores file system event information obtained from module 315/buffer 310 in buffer 315. This approach permits a more rapid response to events coming “up” from kernel-mode module 305 and, in addition, provides additional time for user-level module 315 to process the collected information (see discussion below). Once buffer 320 fills or after user-level module 315 completes its processing, module 315 writes (identified by path 345) the captured and/or processed file system event information to an external file (e.g., file 350) on storage device 355. In one embodiment, file 350 is a database file (e.g., a SQL database file). In another embodiment, file 350 is a flat file. In still another embodiment, file 350 is a temporary file that may later be incorporated into an event database or other event log.
Another aspect of file tracking method 100 is that user-level module 315 may aggregate event information obtained from intercept module 305/buffer 310. In prior art file system tracking procedures, each individual file system event captured is reported. In contrast, file tracking methods in accordance with the invention may intelligently aggregate captured events to reduce the number of reported events while, at the same time, reporting more user-relevant events. By way of example, consider typical office automation programs such as Microsoft Access,® Excel,® Powerpoint® and Word applications. (MICROSOFT ACCESS, EXCEL and POWERPOINT are registered trademarks of the Microsoft Corporation.)
Referring to FIG. 4, in these and similar applications the file to be edited (e.g., original file 400) is copied into working memory from storage to create a working file such as, for example, work file 405 (action designated by {circle around (1)}). A user, through the application, may then edit working file 405 (action designated by {circle around (2)}). When either the program or user determines it is time to “save” the file being edited, work file 405 is written from working memory to storage into work file 410 (action designated by {circle around (3)}), original file 400 is renamed to file 415 (action designated by {circle around (4)}), work file 410 is renamed so that its name is the same as that of the original file, 420 (action designated by {circle around (5)}) and, finally, original file 400 is deleted (action designated by {circle around (6)}). In prior art file system tracking techniques, the described “save” operation would have generated 4 event records (actions {circle around (3)}, {circle around (4)}, {circle around (5)} and {circle around (6)}). In contrast, file tracking method 100 detects this pattern of activity (file A→B, followed by file C→A, followed by deleting file B) and, if it occurs within a designated time period (e.g., between 0 and 3 seconds), records a single event: File Save.
Similar aggregation processing may occur with other user-designated file operations such as, for example, file moves (copy file A to a new location, followed by deleting original file A) and file copy operations. By way of example, a file open operation followed by one or more read operations into a specified memory (e.g., buffer memory) and a file create operation in which the information used to “populate” the new file comes from the same memory associated with the opened file can be recognized as a file copy operation—regardless of the amount of time the copy operation takes. Thus, in accordance with one embodiment of the invention a potentially large number of file system events (file open event+many, possibly thousands, of read events+file create event+many, possibly thousands, of write events where the read and write memory is common) may be conveniently collapsed or aggregated into a single event log: copy file A to file B by user C at time D. It will be recognized that such pattern recognition and event aggregation techniques are lacking form prior art file system tracking applications. It will be further recognized in light of the current description that such aggregation can eliminate up to 95% of the entries in a file system tracking log by virtue of thousands of read and/or write operations being associated with a single file operation (e.g., copy, move and rename).
One benefit of file tracking method 100 in accordance with the invention is that it can reduce the number of events logged (through aggregating events identified though the detection of predefined patterns of activity) which, in turn, provides improved readability of activity reports. Another benefit in accordance with the invention is that it allows file tracking to be administered on any level desired (user, process, file or directory). Yet another benefit of the invention is that user account information may be recorded. Still another benefit of the invention is that designated processes may be excluded for tracking. For example, it is known that virus monitoring software periodically reads substantially all files in a file system. If all such events were recorded the system administrator would be inundated with irrelevant activity (this is what prior art file system monitoring applications do). In accordance with the invention, however, specified activities (e.g., file read events) of a specified user or process may be excluded.
Various changes in the materials and components as well as in the details of the illustrated operational methods are possible without departing from the scope of the following claims. For instance, file tracking methods in accordance with the invention may be used in operational environments other than those running the Microsoft Windows operating system. In addition, not all of the information identified as being collected for a particular embodiment need be collected. In like manner, more information then described herein may be captured. In addition, while file tracking method 100 has been described as being a monolithic entity (e.g., service 300), it will be recognized that in practice it may comprise two or more separately executing threads. For example, a kernel thread may embody the functions described for intercept module 305 while a user thread may embody the functions ascribed to user-level module 315. Further, file tracking method 300 does not have to be implemented as a “service.” That is, a file event tracking method and system in accordance with the invention may run as a standard executable. That is, requiring an active user session to acquire and collect file system event information.
Acts in accordance with FIGS. 1 and 4 may be performed by a programmable control device executing instructions organized into one or more program modules. A programmable control device may be a single computer processor, a special purpose processor (e.g., a digital signal processor, “DSP”, a plurality of processors coupled by a communications link or a custom designed state machine. Custom designed state machines may be embodied in a hardware device such as an integrated circuit including, but not limited to, application specific integrated circuits (“ASICs”) or field programmable gate array (“FPGAs”). Storage devices suitable for tangibly embodying program instructions include, but are not limited to: magnetic disks (fixed, floppy, and removable) and tape; optical media such as CD-ROMs and digital video disks (“DVDs”); and semiconductor memory devices such as Electrically Programmable Read-Only Memory (“EPROM”), Electrically Erasable Programmable Read-Only Memory (“EEPROM”), Programmable Gate Arrays and flash devices.

## Claims

1. A file system audit method, comprising:
intercepting, by a kernel level application, file system events;
recording the intercepted file system events in a kernel memory;
retrieving the recorded file system events from kernel memory to a user level memory;
identifying, from the retrieved file system events, a first file system event changing a first file system object's name from a first name to a second name;
identifying, from the retrieved file system events, a second file system event changing a second file system object's name to the first name;
consolidating the first and second file system events into a distinct third file system event; and
recording the third file system event as a file modification event for the first file system object.

2. The method of claim 1 further comprising, prior to the act of consolidating, identifying, from the retrieved file system events, a file system delete event for the first file system object.

3. The method of claim 1, wherein
the act of identifying the first file system event comprises determining a first time associated with the first file system event,
the act identifying the second file system event comprises determining a second time associated with the second file system event, and
the act of consolidating occurs only if the time between the first and second times is within a specified range.

4. The method of claim 3, wherein the specified range is approximately 2 seconds.

5. The method of claim 1, wherein the act of recording comprises writing to a log.

6. The method of claim 1, wherein the act of writing to a log comprises writing to a database.

7. The method of claim 6, wherein the database comprises a SQL database.

8. A program storage device, readable by a programmable control device, comprising instructions stored on the program storage device for causing the programmable control device to perform the method of claim 1.

9. A file system audit method, comprising:
intercepting, by a kernel level application, file system events;
recording the intercepted file system events in a kernel memory;
retrieving the recorded file system events from kernel memory to a user level memory;
identifying, from the retrieved file system events, a first file system event copying a first file system object from a first location to a second location;
identifying, from the retrieved file system events, a second file system event deleting the first file system object from the first location;
consolidating the first and second file system events into a distinct third file system event; and
recording the third file system event as a file move event for the first file system object.

10. The method of claim 9, wherein the act of consolidating occurs only if a time associated with the first file system event and a time associated with the second file system event within a specified time interval.

11. The method of claim 10, wherein the specified time interval is approximately 2 seconds.

12. A program storage device, readable by a programmable control device, comprising instructions stored on the program storage device for causing the programmable control device to perform the method of claim 9.