Enter invisible characters in a log sample

Updated at:

You may need to use an invisible character as a log delimiter or quote character. This topic describes how to enter an invisible character in a log sample.

Background information

  • Using common characters like commas (,) or semicolons (;) as a delimiter or quote character can cause parsing errors, especially if you need to preserve the original log format. Invisible characters, which are rare in normal text, prevent these errors.

  • Invisible characters are non-printing characters, corresponding to ASCII codes 1-31 and 127. When collecting data in delimiter mode, you can set an invisible character as the delimiter and quote character. To specify an invisible character, use its hexadecimal ASCII representation in the format 0x${HEX}, where HEX is the character's hexadecimal code.

  • This procedure uses a log sample of 123456780, a delimiter of 0x01, and a quote character of 0x02 to demonstrate how to insert the invisible character 0x01 between the digits 5 and 6.

Procedure

  1. Enter the Delimiter - Text Log mode. For detailed steps, see Collect text logs from a host.

  2. On the Logtail configuration page, right-click a blank area in your browser and click Inspect.

    image

  3. In the panel that opens, click the Console tab.

  4. Enter the following code and press Enter.

    const input = document.createElement('input');
      document.body.appendChild(input);
       input.setAttribute('value', String.fromCharCode(0x01));
      input.select();
      if (document.execCommand('copy')) {
        document.execCommand('copy');
        console.log('Copy successful');
      }
  5. Paste the copied character between the digits 5 and 6 in the log sample.

    image

  6. Set the delimiter and quote character to the respective invisible characters.

    image