vRealize Log Insight, vRLI

vRLI JSON Parser and vRO Log Messages

Problem statement:

In certain cases vRO workflow(s) are producing not very well structured  log messages.

“not well structured” means in this case that various workflow runs  may generate log messages which could include variable information in terms of number of key:value pairs as well as the values themselves.

For example we might have a workflow doing a certain complex automation job and depending on the job details the number and the actual content of information may be totally different.

What we could do is to try to put structure in the unstructured data in the workflow logic and use one of the well known vRLI parsers (KVP, CSV etc.) to parse the values for future use in vRealize Log Insight.

But what if this is not possible because for example the number of key:value pairs is unknown. Or the “keys” might change in every run?

Solution:

This is where the vRealize Log Insight JSON parser helps you.

The only two things you need to do is:

  • write your vRealize Orchestrator log messages in JSON format
  • Include the JSON parser in your vRLI agent config

vRLI will automatically recognize the format and parse the key:value pairs accordingly.

Example:

Here a very simple example of two lines of code doing nothing but writing log:

myLogMessage ="{\"command\":\"adduser\",\"orderId\":\"123456789\",\"orderCustomer\":\"customer01\",\"message01\":\"text01\",\"message02\":\"text02\",\"message03\":\"text03\",\"message04\":\"text04\"}";

System.log (completeMessage);

In this simple example you see several key:value pairs:

"command":"adduser",
"orderId":"123456789",
"orderCustomer":"customer01",
"message01":"text01",
"message02":"text02",
"message03":"text03",
"message04":"text04"

The format of the JSON can be completely unknown for the vRLI parser.

To enable vRLI parse the JSON message, we need to edit the vRLI Agent configuration. This is how the configuration looks like in the template provided by the vRealize Orchestrator Content Pack vor vRLI:

The default configuration uses the clf-parser as the parser for the log message.

Inserting the JSON-parser here let vRLI recognize all key:value pairs in the log message:

And here the parsed message in vRLI (open image in an new tab too see details):

If your message contains new key:value pairs during the next run, you do not need to adjust anything, the parser is automatically parsing any new or changed key:value pairs:

Have fun with the vRLI JSON parser:-)

Thomas

Leave a Reply

Your email address will not be published.