Skip to main content

Fileset Script Logging on macOS and Windows

What FileWave records

ForFileWave enables logging by default for scripts added to FileWavea FilesetsFileset usingthrough the Script view,view. loggingThe islog enabledrecords bythe default.script's standard output, timestamps, and exit code.

Pasted Graphic 59.png

WhenWhere to find Fileset script logs

Each time aFileWave Scriptruns (asthe builtscript, above)it iscreates actionedor onappends a device,to a log filefile. is created or added to, with anything that the script outputs.  The logs of these ScriptsLogs are locatedstored in thea following directories, within subfolderssubfolder named afterfor the Fileset ID:ID. The examples below show the macOS and Windows locations.

macOS

# ls -al /private/var/log/fwcld/   
total 0
drwxrwxrwx  17 root  wheel   544 Mar  5 16:01 .
drwxr-xr-x  83 root  wheel  2656 Jul 31 08:27 ..
drwxrwxrwx   3 root  wheel    96 Aug  1  2023 1
drwxrwxrwx   5 root  wheel   160 Sep 25  2023 54231
drwxrwxrwx   6 root  wheel   192 Sep 26  2023 54235
drwxrwxrwx   3 root  wheel    96 Nov  9  2023 54367
drwxrwxrwx   3 root  wheel    96 Nov  9  2023 54368
drwxrwxrwx   3 root  wheel    96 Nov  9  2023 54374
drwxrwxrwx   3 root  wheel    96 Nov  9  2023 54379
drwxrwxrwx   3 root  wheel    96 Nov 10  2023 54384
drwxrwxrwx   3 root  wheel    96 Nov 10  2023 54396
drwxrwxrwx   3 root  wheel    96 Nov 10  2023 54401
drwxrwxrwx   3 root  wheel    96 Nov 10  2023 54406
drwxrwxrwx   3 root  wheel    96 Dec 15  2023 54417
drwxrwxrwx   3 root  wheel    96 Dec 15  2023 54419
drwxrwxrwx   3 root  wheel    96 Dec 15  2023 54421
drwxrwxrwx   3 root  wheel    96 Mar  5 16:01 55188

Windows

image.png

Example:

Read a script log

macOSThis example,example butuses themacOS. principleWindows islogs contain the same forheader, Windows.script output, footer, and exit-code information.

Consider this simple shell script that runs a command to output the username that ran the command:

Pasted Graphic 60.png

On running the command, the user running the command will be reported.  For example, running this locally on a device might reply:

% whoami
sholden

Viewing the log generated by FileWave:

# cat /private/var/log/fwcld/54421/whoami.sh.log
----------------------- HEADER - Date: (Fri Dec 15 2023) - Time: (16:40:21) -----------------------
root
----------------------- FOOTER - Date: (Fri Dec 15 2023) - Time: (16:40:22) - Exit code: (0) -----------------------

The outputlog presents:contains:

Add useful diagnostic output

Some commands produce no standard output. Add concise echo statements or the equivalent for the script betweenlanguage so the Headerlog identifies the step being attempted, the condition found, and Footer

Improvement

The Script may or may not provide output, depending upon the commandreason used.for a However,nonzero why not add additional echo commands (or similar) to output extra details to provide more information from the script running.exit.

Here is an example of a Fileset Requirement Script, waiting for confirmation of a Profile to be installed before activating the Fileset:

Pasted Graphic 61.png

The script is outputting additional information, showing the ID of the Profile, found or not.  On success, exit 0, else exit 1.

By default, a Requirement ScriptsScript will retryretries every 2two minutes,minutes until successful,it succeeds, unless codedthe otherwisescript or Fileset logic changes that behavior.

----------------------- HEADER - Date: (Thu Jul 31 2024) - Time: (11:03:12) -----------------------
Did not find ml1063.local.aa0bd493-960d-4dc0-9631-a3fea189191e.Configuration.aa0bd493-960d-4dc0-9631-a3fea189191e
Did not find ml1063.local.5a57bcb9-7293-4cba-a20b-126eb2660b25.Configuration.5a57bcb9-7293-4cba-a20b-126eb2660b25
----------------------- FOOTER - Date: (Thu Jul 31 2024) - Time: (11:03:12) - Exit code: (1) -----------------------

----------------------- HEADER - Date: (Thu Jul 31 2024) - Time: (11:05:12) -----------------------
Found installed profile:  ml1063.local.aa0bd493-960d-4dc0-9631-a3fea189191e.Configuration.aa0bd493-960d-4dc0-9631-a3fea189191e
----------------------- FOOTER - Date: (Thu Jul 31 2024) - Time: (11:05:12) - Exit code: (0) -----------------------

On first attempt, the log shows two Profiles were searched and not found, with the script exiting a value of 1.  On second attempt, the first Profile ID is now showing as installed and the script exited with a value of 0.

NoScripts Logswithout a Fileset log

Some scriptsFileWave ranscript throughcontexts, FileWave, e.g.including Policy Blocker Scripts,scripts, do not provide logs, with some mention increate the Fileset script log shown above. The FileWave Client Loglog alone,may record only that the Scriptscript ran.

However,When itthat iscontext entirelyneeds possiblemore todetail, choosehave tothe createscript write a customdedicated log file within a script, for any script, and echoinclude anyonly the diagnostic output desiredadministrators to provide additional logging.need.

ConsiderPlan howlog therotation.
Choose scriptwhether willeach growrun and how to eithershould overwrite or appendappend, appropriately.and prevent an append-only log from growing without a limit.