Back to Beats

elastic_ntfs_file

x-pack/osquerybeat/ext/osquery-extension/docs/tables/elastic_ntfs_file.md

9.5.03.6 KB
Original Source

% This file is generated! See ext/osquery-extension/cmd/gentables.

elastic_ntfs_file

Returns information about files on NTFS volumes, parsed from the $MFT file on Windows systems.

Platforms

  • ❌ Linux
  • ❌ macOS
  • ✅ Windows

Description

Returns information about files on NTFS volumes, parsed from the $MFT file on Windows systems. The $MFT file contains metadata about all files and directories on an NTFS volume, including their names, sizes, timestamps, and attributes. This table parses the $MFT file to extract this information and present it in a structured format. Note that this table is Windows-only, as the $MFT file is specific to the NTFS file system used by Windows.

Schema

ColumnTypeDescription
driveTEXTVolume drive letter (e.g. C)
deviceTEXTPhysical device path (e.g. \\.\PhysicalDrive0)
partitionINTEGERPartition number of the volume (e.g. 1)
inodeBIGINTMFT record number (inode)
sequence_numberINTEGERMFT entry sequence number
parent_inodeBIGINTMFT record number of the parent directory
pathTEXTFull file path (e.g. C:\Windows\system32\ntoskrnl.exe)
directoryTEXTFull path of the parent directory
filenameTEXTFile name component from the $FILE_NAME attribute
typeTEXTEntry type ("file" or "directory")
hard_link_countINTEGERNumber of hard links to this MFT entry
activeINTEGER1 if the MFT entry is allocated (active), 0 if not
sizeBIGINTLogical file size in bytes (from the default $DATA attribute)
allocated_sizeBIGINTAllocated size in bytes (from the $FILE_NAME attribute)
flagsINTEGERFile attribute flags from $STANDARD_INFORMATION
adsINTEGER1 if the file has one or more Alternate Data Streams, 0 otherwise
object_idTEXTObject identifier GUID from the $OBJECT_ID attribute
security_idINTEGERSecurity descriptor identifier from $STANDARD_INFORMATION
owner_idINTEGEROwner identifier from $STANDARD_INFORMATION
btimeBIGINTFile creation time (Unix epoch) from $STANDARD_INFORMATION
mtimeBIGINTFile last-modified time (Unix epoch) from $STANDARD_INFORMATION
ctimeBIGINTMFT entry last-modified time (Unix epoch) from $STANDARD_INFORMATION
atimeBIGINTFile last-accessed time (Unix epoch) from $STANDARD_INFORMATION
fn_btimeBIGINTFile creation time (Unix epoch) from $FILE_NAME
fn_mtimeBIGINTFile last-modified time (Unix epoch) from $FILE_NAME
fn_ctimeBIGINTMFT entry last-modified time (Unix epoch) from $FILE_NAME
fn_atimeBIGINTFile last-accessed time (Unix epoch) from $FILE_NAME

Examples

Path lookup

sql
SELECT * FROM elastic_ntfs_file WHERE path = 'C:\Windows\System32\ntoskrnl.exe';

Inode lookup (drive constraint required)

sql
SELECT * FROM elastic_ntfs_file WHERE inode = 1972769 AND drive = 'C';

Directory + filename glob

sql
SELECT * FROM elastic_ntfs_file
WHERE directory = 'C:\Windows\System32' AND filename GLOB '*.exe';

Notes

  • Windows only
  • Glob patterns are not recursive. A query like WHERE directory = 'C:\Windows' AND filename GLOB '*.exe' will not find C:\Windows\System32\notepad.exe
  • Integer columns with value 0 are returned as empty string by the osquery wire protocol, not "0". Use numeric comparison (e.g. WHERE ads = 0, not ads = '0').
  • elastic_ntfs_partitions
  • elastic_ntfs_volumes