Log not written to JSS

golbiga
Contributor III
Contributor III

I noticed a few of my custom trigger policies during firstboot are executing, but the log is not being sent to my JSS. When adding the -verbose flag I will get "Log was not written in the JSS. Will store locally." Any ideas why this is happening? I'm running 8.43.

Thanks
Allen

1 ACCEPTED SOLUTION

JRM
Contributor

There is an issue with the percent '%' character in log files. I ran into this because I was using a curl command, and curl was outputting % marks. There are a few ways around this.

The first is to modify the command/output to remove or change the percent.

Since I had a lot of old logs I wanted I wrote a script to modify them so they would upload.

#!/bin/bash

SAVE_IFS="$IFS"
IFS=$'	
'

LOG_PATH='/Library/Application Support/JAMF/logs/'

LogFiles="`ls $LOG_PATH*.log`"

for i in $LogFiles; do
    echo -n "working on "$i" "
    perl -pi -e "s/%/~/g" $i
    echo done
done

IFS=$SAVE_IFS

This can be an issue though. If you have a lot of logfiles you can slow down your JSS with the updates. (any 15 or whatever your duration, is when they will upload)

The issue I ran into with my script is that it didn't persevere the actual date ran. (unless it was in the log file) So you might want to add something that reads in the date of the log file and add's it to the file.

If you don't care about the old log files you can write a script to remove them, but you will need to fix any commands outputting percent's to either drop them or output something else.

If you care about the log files you will want to do some combination of everything.

View solution in original post

4 REPLIES 4

JRM
Contributor

There is an issue with the percent '%' character in log files. I ran into this because I was using a curl command, and curl was outputting % marks. There are a few ways around this.

The first is to modify the command/output to remove or change the percent.

Since I had a lot of old logs I wanted I wrote a script to modify them so they would upload.

#!/bin/bash

SAVE_IFS="$IFS"
IFS=$'	
'

LOG_PATH='/Library/Application Support/JAMF/logs/'

LogFiles="`ls $LOG_PATH*.log`"

for i in $LogFiles; do
    echo -n "working on "$i" "
    perl -pi -e "s/%/~/g" $i
    echo done
done

IFS=$SAVE_IFS

This can be an issue though. If you have a lot of logfiles you can slow down your JSS with the updates. (any 15 or whatever your duration, is when they will upload)

The issue I ran into with my script is that it didn't persevere the actual date ran. (unless it was in the log file) So you might want to add something that reads in the date of the log file and add's it to the file.

If you don't care about the old log files you can write a script to remove them, but you will need to fix any commands outputting percent's to either drop them or output something else.

If you care about the log files you will want to do some combination of everything.

golbiga
Contributor III
Contributor III

Just ran your script on one of the machines that did not update it's logs to the JSS and on the next policy check it updated. Did you submit a bug to JAMF?

Thanks!

cbrewer
Valued Contributor II

I've run into this as well. It's a defect they know about. Hopefully we'll see it fixed in 8.5.

mm2270
Legendary Contributor III

I'm actually running into this issue now. I am also using a curl command in a policy and its failing to submit the logs, but more importantly, it seems to be killing my curl command also. I get a file downloaded, but it has zero content. Running the same curl command in Terminal to the same location works perfectly fine.

Does anyone know of some way to prevent this? How can I get a curl command to run from a script being run from the JSS and have it not error?
BTW, we are still on 8.4, so perhaps this was fixed in 8.5 as you surmised. I'll have to look at the release notes and see.