Text formatting in Casper logs

amosdeane
New Contributor III

I’ve recently created a script to report various system/status settings on a group of machines, which I can then study via the policy logs in Casper. To improve the readability of the output I’ve incorporated some switches to add tabs and new lines in appropriate places. This works well if I run the script locally and output to text file, but, when the script is run via Casper some of the formatting is ignored in the logs – e.g. printf and echo –e switches. I’ve spoken with tech support and it appears that this formatting is not supported via Casper logs.

Has anyone else found this to be a problem and/or found a way around it – other than outputting to text files and uploading to the JSS?

3 REPLIES 3

mm2270
Legendary Contributor III

Yeah, I've run across this as well. One of the scripts I've built does a fair amount of logging that gets uploaded later into the policy log. The log entries have tabs for indenting in certain places in order to create some visual "grouping" of related log items. When I run the script in Terminal, even if using sudo jamf runScript -script "script.sh" -path /path/to/script/, etc, I see the formatting show correctly. But when run out of a policy, it gets ignored in the log that I view in the JSS, just as you stated.

TBH, earlier versions of Casper even ignored line breaks, which made for some seriously ugly logs in the JSS - long run on lines - so at this point, I'm glad to have proper line breaks and just live with the fact that it doesn't respect some of the special formatting I've put into my scripts. It would be great if JAMF could make it respect them, but its not a deal breaker for me personally.

amosdeane
New Contributor III

I'm glad to see someone else has noticed this. I may resort to outputting to text files on the distribution point. It's not crucial, but it does enhance the reporting potential.

Look
Valued Contributor III

@mm2270

Hah! I'd never really noticed they were including the line breaks now! Time to go back through all my old scripts and remove all the "---" I was putting in to seperate everything!
They were hideous before for long scripts with lots of logging.