How can I format the logs showing in the iris terminal of a kubernetes instance to be in json format and if possible with extra instance fields
Hi!
We are working on containerizing our IRIS product. We want to extract the message log that is shown in the terminal, but if possible, we want to format the output as JSON and include some extra fields from the instance to enhance our monitoring. Is this possible?
Any guide or example about it?
Thanks!
Comments
any ideas in mind, how exactly you would like to look it as a json?
in our project with just put containers output to splunk, with a sidecar container, somewhere in that prcess it adds host, serivec other info that helps to filter to particular instance easily
Nothing special, just exploring possibilities , if possible I like to avoid sidecar or external apps like fluentd, our infrastructure clusters already come with the scrapping of the pods.
I was exploring the https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GCM_structuredlog and https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=ITECHREF_cconsole_log I succeded on generating a Json file, but can't make it go to the output of the pod.
Wondering if it's possible
So, looks like you already got what you wanted with json
then the only thing left is to redirect your new log file to a container's log, to do so, you should send it to PID 1
/iris-main has this option, so, just add your log file to a container command
-l <log file>, --log <log file>
InterSystems IRIS log file to be redirected to stdout for monitoring
via 'docker logs'