> For the complete documentation index, see [llms.txt](https://docs.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.collibra.com/data-quality-self-hosted/core-concepts/explorer/managing-the-jobs-page/logging/convert-log-outputs-to-json-formatting.md).

# Convert log outputs to JSON formatting

If you want to ingest your log outputs into a third-party log consumer, such as Elasticsearch, you can convert DQ logs to JSON formatting. This page shows you how to convert DQ logs to JSON formatting in Standalone deployments of Data Quality & Observability (self-hosted).

{% hint style="info" %}
This option is currently unavailable for Cloud Native deployments of Data Quality & Observability (self-hosted).
{% endhint %}

## Steps

{% stepper %}
{% step %}
Open the **dq-web** folder and then open the **log4j2.xml** file.
{% endstep %}

{% step %}
In the **\<Appenders>** section, look for the following line of code:

`<PatternLayout pattern="%d{yy/MM/dd HH:mm:ss.SSS} %X{sessionId} %X{sessionHost} %X{userName} [%t] %-5level %logger{36} - %m{nolookups}%n"/>`
{% endstep %}

{% step %}
Comment out the `<PatternLayout` section with the following `<JsonLayout` to convert the output from Pattern to JSON:

```
<!--<PatternLayout pattern="%d{yy/MM/dd HH:mm:ss.SSS} %X{sessionId} %X{sessionHost} %X{userName} [%t] %-5level %logger{36} - %m{nolookups}%n"/>-->
<JsonLayout objectMessageAsJsonObject="true" complete="false" eventEol="true" compact="true" properties="true" includeTimeMillis = "true"></JsonLayout>
```

{% hint style="info" %}
You can remove the `<!-- ... -->` from the commented out line of code to revert from the JsonLayout to the PatternLayout format.
{% endhint %}
{% endstep %}

{% step %}
Set the `compact=` attribute to one of the following options:

1. `compact="true"` for compact JSON payloads.
2. `compact="false"` for decompressed JSON payloads.
   {% endstep %}

{% step %}
Optionally review the other attributes in the JSON layout.

| Attribute                 | Data Type | Description                                                                                                                                                                                                                                  |
| ------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| complete                  | boolean   | <p>When set to <em>true</em>, the appender includes the JSON header and footer. Records are comma-delimited.</p><p>The default value is <em>false</em>.</p>                                                                                  |
| includeTimeMillis         | boolean   | When set to *true*, the appender includes the timeMilis attribute in the JSON payload instead of the instant. timeMillis contains the number of milliseconds since January 1, 1970 at midnight UTC.                                          |
| objectMessageAsJsonObject | boolean   | <p>When set to <em>true</em>, ObjectMessage is serialized as JSON object to the message field of the output log.</p><p>The default values is <em>false</em>.</p>                                                                             |
| compact                   | boolean   | <p>When set to <em>true</em>, the appender does not use end-of-lines or indentation.</p><p>The default value is <em>false</em>.</p>                                                                                                          |
| eventEol                  | boolean   | <p>When set to <em>true</em>, the appender appends an end-of-line after each record.</p><p>The default value is <em>false</em>.</p><p>To see one record per line, set both <code>eventEol="true"</code> and <code>compact="true"</code>.</p> |
| properties                | boolean   | <p>When set to <em>true</em>, the appender includes the thread context map in the generated JSON.</p><p>The default value is <em>false</em>.</p>                                                                                             |
| includeStacktrace         | boolean   | <p>Optional. When set to <em>true</em>, the appender includes full stacktrace of any logged <a href="https://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html">Throwable</a>.</p><p>The default value is <em>true</em>.</p>        |
| {% endstep %}             |           |                                                                                                                                                                                                                                              |
| {% endstepper %}          |           |                                                                                                                                                                                                                                              |

{% hint style="success" %}
You can optionally keep both the JSON and Pattern layouts by writing logs in a different file.
{% endhint %}
