Change the export delimiter in Log Analytics Workspace on Azure Portal?

78 Views Asked by At

I want to change the csv delimiter from the default comma to a pipe. There does not seem to be an option on the Export dropdown. Is there any way to do this?

enter image description here

1

There are 1 best solutions below

2
RithwikBojja On BEST ANSWER

I want to change the csv delimiter from the default comma to a pipe.

No, currently this is not supported and there is no direct way to do it. But you can use other tools to the do same, such as Azure Logic Apps with below design:

enter image description here

replace(body('Create_CSV_table'),',','|')

Output:

enter image description here

The above data can be sent in file in mail or to blob in blob storage from there you can download it.

Alternatively you can use JS like below:

enter image description here

Inline script:

var rithinput =workflowContext.actions.Compose.outputs;
const rithdelimiter = '|';


const rith_head = Object.keys(rithinput[0]);
let Filecontent = rith_head.join(rithdelimiter) + '\n';
rithinput.forEach(obj => {
  const row = rith_head.map(header => {
    let value = obj[header];
    if (typeof value === 'string' && value.includes(rithdelimiter)) {
      value = `"${value}"`;
    }
    return value;
  });
  Filecontent += row.join(rithdelimiter) + '\n';
});

return Filecontent;

Output:

enter image description here

The above data can be sent in file in mail or to blob in blob storage from there you can download it. You can also use azure functions, powershell other than logic apps.