6

If I run software update on a Mavericks Mac it will find a caching server automagically if there are any running locally rather than using the CDN Apple hosts on the internet. I'm not so much concerned about security as just knowing when and if the server is running correctly without having any sort of log in to the server itself.

Is there a log file on the client end or another way to determine this conclusively?

bmike
  • 235,889
  • As far as I know, this is meant to be invisible to the end user... happy to be proven wrong on this. – pknz Aug 28 '14 at 03:52
  • I'm hoping I don't have to use lsof to record open network ports while the update is running, but hopefully someone has some insight on how this works or perhaps a debug setting to get this logged. We will see in time perhaps. – bmike Aug 28 '14 at 13:29
  • Nothing's 'standing out' in the client logs so far; looking at network traffic would be cumbersome though… – grg Aug 29 '14 at 19:08
  • @GeorgeGarside I wonder if debug mode would help? http://apple.stackexchange.com/questions/17816/does-the-lion-app-store-have-a-debug-menu – bmike Aug 29 '14 at 19:15
  • This is exactly what I was in the process of doing! :) Now to find a VM with a pending update to test… – grg Aug 29 '14 at 19:17

2 Answers2

13

The caching server will print to log when a client requests an update. This log is located at:

/Library/Server/Caching/Logs/Debug.log

The following is the anatomy of a request which was served by the caching server's cache:

  • Client requests update package

    Got request for host = http://swcdn.apple.com/{{REQUEST}}
    
  • Find cached package in server data

    Initializing asset handler for http://swcdn.apple.com/{{REQUEST}} (path = /Library/Server/Caching/Data/{{UDID}})
    
  • Check/load asset in cache

    Cached asset length = {{LENGTH}} MD5={{CHECKSUM}} last modified {{DATE/TIME}}
    Extents loaded from disk: {{DATA}}
    Data already cached for asset http://swcdn.apple.com/{{REQUEST}}, issuing If-Modified-Since request
    Info loaded: file length = {{DATA}}, reader = {{DATA}}
    
  • Serve asset to client from cache

    {{BYTES}} bytes served, {{SERVED_BYTES}} from cache, 0 downloaded
    

    This 0 downloaded is what shows the update was entirely served by the caching server.

  • Finish

    Outgoing connection finished
    
grg
  • 201,078
  • This would be great except for the *"without having any sort of log in to the server itself"* requirement. – bmike Aug 26 '14 at 22:16
  • @bmike Totally missed that in the question… I'll look into it again tomorrow (UTC) – grg Aug 26 '14 at 22:21
  • 2
    It is worth keeping that answer since for many it will be the ideal solution. If you find another, queue up a second answer :) – bmike Aug 26 '14 at 22:22
  • 1
    A simple way to allow access without too much fuss and risks would be to activate "Websites" services and add an alias (eg path /Logs/Server/Caching folder /Library/Server/Caching/Logs)... You may also add "Debug.log" as an Index File... – llange Aug 29 '14 at 19:06
  • 1
    This log file doesn't appear to exist anymore, but similar data can be accessed via the new os_log system with something like log show --predicate 'subsystem == "com.apple.AssetCache"' --info --debug. – ravron Mar 26 '20 at 00:29
4

I'm not sure on which version this stat became available, but in version 5.0.15 you can see a graph of the data served by the caching service:

Caching service statistic graph

habc_hden
  • 141
  • Exactly - the server log is much more detailed than the aggregate graph. The reason I'm asking about determining updates on the client end is to correlate and match the activity I see from the server as well as know when an update happened on the client side when I have no access to the server. – bmike Dec 18 '15 at 14:57
  • Are these stats still available somewhere now the caching server has moved out of Server.app? (cc @bmike) – grg Apr 07 '23 at 09:51
  • Yes @grg - Activity Monitor has the graph in a tab to the far right of the usual tabs in that app's main window. There is also AssetCacheManagerUtil status which is a new-ish command line tool to manage the caching system. – bmike Apr 07 '23 at 16:43