erikng / Cacher

A python script for extracting macOS Caching Server data
Apache License 2.0
134 stars 40 forks source link

Attempt unzip of bzip files only if they exist #9

Closed erikng closed 7 years ago

erikng commented 9 years ago

This will reduce logging errors.

calum-github commented 8 years ago

You don't need to unzip them. You can use bzgrep to grep through the zip files

eg: you could do something like:

SVR_DEBUG_LOGS=$(ls -d ${LOG_LOCATION}/* | grep -v -e "AssetCache.pid" -e "LastState.plist")

for DEBUG_LOG in $SVR_DEBUG_LOGS; do 
    echo "- Searching log: $DEBUG_LOG for entries from: $YESTERDAY ..."
    bzgrep -E ^\s*"${YESTERDAY}" "$DEBUG_LOG"  >> "${TMP_LOCATION}"/MergedLog-"${YESTERDAY}".log
done
erikng commented 8 years ago

Send a PR.

erikng commented 7 years ago

This issue will be fixed in the next version of Cacher