This is what I have in my action script whic in the end upload the logs to upload manager.
and there is another fixlet we run which move the logs in the central location in upload mgr and curl put to our unx server.
def build_xml(computer_target):
action_script="""\ndelete __appendfile\
\ndelete /tmp/sox.sh\
\nappendfile os_name=`hostname`\
\nappendfile short_name=`echo $os_name|awk -F. ' {{print $1}'`\
\nappendfile dt=`date +%y%m%d`\
\nappendfile log=/tmp/sox.txt\
\nappendfile bftask_log=/tmp/bftask_sox.log\
\nappendfile err1=""\
\nappendfile err2=""\
\nappendfile cmd_arg=$1\
\nappendfile script_arg=""\
\nappendfile if [ -z "$cmd_arg" ]\
\nappendfile then\
\nappendfile echo "Usage: pass argument 0,1=-f and 2='-z -f' "\
\nappendfile exit 1\
\nappendfile fi\
\nappendfile if [ "$cmd_arg" = "0" ]\
\nappendfile then\
\nappendfile script_arg=""\
\nappendfile fi\
\nappendfile if [ "$cmd_arg" = "1" ]\
\nappendfile then\
\nappendfile script_arg="-f"\
\nappendfile fi\
\nappendfile if [ "$cmd_arg" = "2" ]\
\nappendfile then\
\nappendfile script_arg="-z -f"\
\nappendfile fi\
\nappendfile run_exp()\
\nappendfile {{\
\nappendfile expect_bin=`which expect`\
\nappendfile if [ ! -z "$expect_bin" ]\
\nappendfile then\
\nappendfile echo "spawn /usr/local/secbase/sox_verification.ksh $script_arg " > /tmp/sox.exp\
\nappendfile echo "sleep 10" >> /tmp/sox.exp\
\nappendfile echo expect "Do you want to continue (y/n)?">> /tmp/sox.exp\
\nappendfile echo send "y\\r" >> /tmp/sox.exp\
\nappendfile echo expect eof >> /tmp/sox.exp\
\nappendfile $expect_bin -f /tmp/sox.exp > $log\
\nappendfile else\
\nappendfile err1="expect binnotfound_after_yum"\
\nappendfile fi\
\nappendfile }\
\nappendfile if [ -f /usr/local/secbase/sox_verification.ksh ]\
\nappendfile then\
\nappendfile k=`which expect`\
\nappendfile if [ ! -z "$k" ]\
\nappendfile then\
\nappendfile if [ "$cmd_arg" = "0" ]\
\nappendfile then\
\nappendfile /usr/local/secbase/sox_verification.ksh $script_arg > $log\
\nappendfile else\
\nappendfile run_exp\
\nappendfile fi\
\nappendfile else\
\nappendfile timeout 20s yum install -y expect.x86_64\
\nappendfile if [ "$cmd_arg" = "0" ]\
\nappendfile then\
\nappendfile /usr/local/secbase/sox_verification.ksh $script_arg > $log\
\nappendfile else\
\nappendfile run_exp\
\nappendfile fi\
\nappendfile fi\
\nappendfile else\
\nappendfile err2="sox_verification.ksh notFound"\
\nappendfile fi\
\nappendfile if [ -f "$log" ]\
\nappendfile then\
\nappendfile echo "soxlog $log Found,$err1,$err2" > $bftask_log\
\nappendfile else\
\nappendfile echo "soxlog $log NotFound,$err1,$err2" > $bftask_log\
\nappendfile fi\
\nappendfile chmod 644 $bftask_log $log\
\nmove __appendfile /tmp/sox.sh\
\nwait chmod 755 /tmp/sox.sh\
\nwait /tmp/sox.sh """+cmd_argu+"""\
\nsetting "_BESClient_ArchiveManager_FileSet-{computer name &"_"& (month of it as two digits & day_of_month of it as two digits & year of it as string) of current date}" = "/tmp/*sox*txt" on "{now}" for client\
\nsetting _BESClient_ArchiveManager_OperatingMode = 2 on "{now}" for client\
\narchive now\
\ndelete /tmp/sox.sh """
#print(action_script)
xml_query='<?xml version="1.0" encoding="utf-8"?>\
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SkipUI="true">\
<SingleAction>\
<Title>Deploy: SOX for Linux</Title>\
<Relevance>exists (operating system) whose (it as string as lowercase contains "Linux" as lowercase)</Relevance> \
<ActionScript>\
'+action_script+'\
</ActionScript>\
<SuccessCriteria />\
<Settings />\
<SettingsLocks />\
<Target>'
xml_query=xml_query+""+computer_target+""+"</Target> </SingleAction></BES>"
xml=xml_query
print("\nBuilding Query XML :"+ xml+"\n")
#sys.exit()
req_bes_query_id=requests.post(bigfix_URL_action,verify=False,auth=(bigfix_username,bigfix_pwd),data=xml)
here is another fixlet which move the logsā¦
parameter "SearchPath" = "G:\Program Files (x86)\BigFix Enterprise\BES Server\UploadManagerData\BufferDir\sha1\*"
parameter "SearchFile" = "*sox.txt"
parameter "BackupPath" = "G:\GATHER\SOX"
// Disable wow64 Redirection
action uses wow64 redirection {not x64 of operating system}
delete __createfile
// Create Powershell script
createfile until END_OF_FILE
Get-ChildItem -Path "{parameter "SearchPath"}" -Include {parameter "SearchFile"} -Recurse | Move-Item -Destination "{parameter "BackupPath"}"
.. need to put curl or invoke to put the logs in the unix host..wintel/bigfix master is going to update that.. I am not wintel/powershell expert
END_OF_FILE
delete BFPowershell.ps1
move __createfile BFPowershell.ps1
// Call Powershell Cmdlet to Parse "SearchPath" folder for "SearchFile" and copy to "BackupPath"
waithidden { pathname of file ((it as string) of value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry) } -ExecutionPolicy Bypass -File BFPowershell.ps1