## Auditing the Persistence Journal

### Overview

To view the persistence journal data log files, use the journal-audit task. Velocity Template Language (VTL) expressions allow you to control how the records are displayed. See Chapter 2 in the Using FUSE™ Message Broker's Persistence Features for details.

You can run the command against the journal archive directory and the active journal directory, as follows:

activemq-admin journal-audit `Options` `JournalDirectory`

### Displaying message records

Message records are created every time a producer sends a persistent message to the broker. The message is recorded in the journal even if its transaction is rolled back.

Use the following syntax to display message records:

activemq-admin journal-audit --message-format=`VTLExpression` `JournalDirectory`

The default VTL expression is as follows:

${location.dataFileId},${location.offset}|${type}|${record.destination}|${record.messageId}|${record.properties}|${body}

| Note
Some operating systems require you to place the entire VTL expression inside single quotes.

### Displaying topic ack records

A topic ack records that a durable subscription for a topic has acknowleged a set of messages.

Use the --topic-ack-format=`VTLExpression` option to display topic ack records:

The default VTL expression is as follows:

${location.dataFileId},${location.offset}|${type}|${record.destination}|${record.clientId}|${record.subscriptionName}|${record.messageId}

### Displaying queue ack records

A queue ack records that a consumer for a queue has acknowleged a message.

Use the --queue-ack-format=`VTLExpression` option to display queue ack records:

The default VTL expression is as follows:

${location.dataFileId},${location.offset}|${type}|${record.destination}|${record.messageAck.lastMessageId}

### Displaying transaction records

Transaction records are used to record transaction related actions like commit and rollback.

You can use the --transaction-format=`VTLExpression` to display transaction records:

The default VTL expression is:

${location.dataFileId},${location.offset}|${type}|${record.transactionId}

### Displaying trace records

Trace records are informational messages stored in the journal that assist in auditing. For example, a trace message is recorded whenever the broker is restarted or when the long term store is checkpointed.

You can display trace records using the --trace-format=`VTLExpression` option.

The default VTL Expression is:

${location.dataFileId},${location.offset}|${type}|${record.message}

### Filtering records

The journal-audit task allows you to filter out records using a SQL like WHERE syntax, as follows:

activemq-admin journal-audit --where=`VALUE`

For example:

activemq-admin journal-audit --where="type='ActiveMQTextMessage' and location.dataFileId > 2"