Filesystem mounts after *nix patching event
System patching is a risky process in a production environment. Based on the method by which the directory was originally mounted, it might not survive the patching and reboot event. You want a search that lets you determine the number of mounted directories before and after a patching event so you can validate the state of the system.
Data required
Procedure
Run the following search. You can optimize it by specifying an index and adjusting the time range.
sourcetype="df" earliest=-15m@m latest=now |eval dataset="last 15m" |append [| search index=<index name> sourcetype="df" earliest=-75m@m latest=-60m@m |eval dataset="1h ago"] |stats dc(dataset) AS dc_dataset values(dataset) AS values_dataset BY filesystem mount host |eval no_longer_mounted = if(dc_dataset=1 AND values_dataset="1h ago", filesystem." -> ".mount, null()) |eval newly_mounted = if(dc_dataset=1 AND values_dataset="last 15m", filesystem." -> ".mount, null()) |eval still_mounted = if(dc_dataset=2, filesystem." -> ".mount, null()) |stats values(*_mounted) AS *_mounted BY host
Search explanation
The table provides an explanation of what each part of this search achieves. You can adjust this query based on the specifics of your environment.
Splunk Search | Explanation |
---|---|
|
Search disk space on mounted volumes. |
|
Search for events occurring in the last 15 minutes |
|
Set the field named dataset to the quoted string. |
|
Search for events that occurred an hour ago and look back for 75 minutes. Append the results to the primary search. |
|
Get a distinct count of the dataset, grouped by file system, and put the contents of the dataset into values. |
|
Create the |
|
Create the |
|
Create the |
|
Create a list of mounted statuses for each directory by host. |
Next steps
Use this procedure to validate that the number of mounted directories is the same before and after the patching event. If the number of directories changed, the system integrity might be compromised and you should perform additional validation.
Sample results for this search are shown in the table below.
host |
no_longer_mounted |
still_mounted |
---|---|---|
|
|
|
|
|
|
|
|
Finally, you might be interested in other processes associated with the Maintaining *nix systems use case.