Format Log Lines with Custom Line Templates

You can use custom line templates to format the lines in the log viewer to make it easier for you to identify specific information that is of interest to you.

  1. Select an existing View or Create and Edit Views.
  2. Select Edit View Properties.
  3. In the Custom %LINE Template area, enter your template.

Display PID, Program, and Log Source

If you have log lines that look similar to the example, you can decide to display the information in a more easily parsed format.

Images of log lines from Viewer.

Images of log lines from Viewer.

  1. Enter PID: {{pid}} | Program: {{program}} | Log Source: {{logsource}} into Custom %LINE Template area.
  2. You logs should now look like:
Bash
Copy

Use Reserved Fields

Reserved fields are marked by an underscore.

If your data resembles:

Bash
Copy

And contains this field metadata:

JSON
Copy

Enter {{_meta.first_name}} {{_meta.last_name}}, aka $@ into Custom %LINE Template area. Using $@ will reference the original line.

This will display log messages in that view in this format:

Bash
Copy

Return as JSON

You can format your data to return as JSON.

JSON
Copy

Formatted Log Line Example

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard