Open ckotte opened 4 years ago
While trying to implement json.NewEncoder
I found out that this is already implemented in func SerializeRunRec
and that this is controlled via the undocumented variable runRecFormatVersion
.
I can fix this by using runRecFormatVersion: 1.4
:
test:
cmd: ls / >> ~/log/test.log
time: '0 */1 * * * *'
onError: Continue
notifyOnSuccess:
- type: program
path: /usr/local/bin/send_jobber_email.sh
runRecFormatVersion: 1.4
notifyOnError:
- type: program
path: /usr/local/bin/send_jobber_email.sh
runRecFormatVersion: 1.4
Before:
{
"job": {
"command": "ls / u003eu003e ~/log/test.log",
"name": "letsencrypt_renewal_test",
"status": "Good",
"time": "0 */1 * * * *"
},
"startTime": "Oct 17 18:27:00 2020",
"stderr": "",
"stderr_base64": false,
"stdout": "",
"stdout_base64": false,
"succeeded": true,
"user": "jobber"
}
After:
{
"fate": 0,
"job": {
"command": "ls / >> ~/log/test.log",
"name": "letsencrypt_renewal_test",
"status": "Good",
"time": "0 */1 * * * *"
},
"startTime": 1602952140,
"stderr": "",
"stdout": "",
"succeeded": true,
"user": "jobber",
"version": "1.4"
}
However, the startTime
is in Unix format now and a few new keys are added as well.
@dshearer I guess runRecFormatVersion
is not documented because func SerializeRunRec
and the new RunRec
are still WIP?
I get this..
This is the "prettified" JSON output, but it looks similar when I don't use
.. but the command is
/backup/container-backup/container-backup.sh -p syncthing-data >> /home/jobber/backup-syncthing-data.log 2>> /home/jobber/backup-syncthing-data.log
I read that this behavior can be disabled in "Go's JSON marshaller" (https://discuss.elastic.co/t/beats-encodes-angle-brackets-and-as-u003c-and-u003e-in-json-output/60667).