# history output-format

## Syntax

```
[no] history <instance> output-format <template>
```

## Syntax Description

<table><thead><tr><th width="203">Keyword</th><th>Description</th></tr></thead><tbody><tr><td><code>no</code></td><td>(Optional) Reverts to the default output format.</td></tr><tr><td>instance</td><td>The history instance to be modified. If the specified instance does not exist, it will be created unless the no keyword was also specified. Must be alphanumeric.</td></tr><tr><td>template</td><td>The history output format template, described below.</td></tr></tbody></table>

## Defaults

The default output format is: "%d? %12t?? sub=%s?? mac=%m?? ip=%21ys?? dest=%21yd?? proto=%L?? policy=%P(%p)?? category=%C(%c)?? group=%G(%g)?? rule=%U(%u)?? button=%b?? count=%n?? stage=%S?? waited=%w?? rxbytes=%xr?? txbytes=%xt?? desc=%E?? ident=%I?? comment=%O?? host=%ah?? country=%N?? cat=%Mh?? flags=%f?? method=%am?? path=%ap?? version=%av?? timeOffset=%J?"

Note that the default format includes fields which are not used in the current product.

## Usage Guidelines

The output format template consists of arbitrary text containing field substitutions. These substitutions begin with a percent sign ("%"). The list of valid substitutions is shown in the table below.

The percent sign may optionally be followed by a decimal minimum field width. The field value will be left-justified within the specified width.&#x20;

A substitution, along with any surrounding text, may optionally be enclosed in question mark characters. This will cause all text between the question marks to be suppressed if no substitution is made.

The contextual help for this command may include subsitutions for fields that are not used in the current product. Only the currently supported subsitutions are included in this table.

<table><thead><tr><th width="209">Subsitution</th><th>Description</th></tr></thead><tbody><tr><td>%d[(format)]</td><td>Date and time formatted using <a href="https://man.freebsd.org/cgi/man.cgi?strftime(3)">strftime</a>. The default format is "%Y/%m/%d %T".</td></tr><tr><td>%D</td><td>Date and time formatted as "yyyy-mm-ddThh:mm:ss.xxx(Z|+/-HH:MM)".</td></tr><tr><td>%f</td><td>Event flags</td></tr><tr><td>%h</td><td>Destination host name</td></tr><tr><td>%H</td><td>Island host name</td></tr><tr><td>%i</td><td>Source IP addres</td></tr><tr><td>%m</td><td>Source MAC address</td></tr><tr><td>%Mh</td><td>Destination host category list</td></tr><tr><td>%N</td><td>Country code</td></tr><tr><td>%O</td><td>Comment</td></tr><tr><td>%rn</td><td>Interface name</td></tr><tr><td>%R</td><td>Constant random number</td></tr><tr><td>%t</td><td>Event type</td></tr><tr><td>%xr</td><td>Bytes received</td></tr><tr><td>%xt</td><td>Bytes transmitted</td></tr><tr><td>%%</td><td>Percent sign</td></tr></tbody></table>

#### Predefined formats:

<table><thead><tr><th width="212"></th><th></th></tr></thead><tbody><tr><td>all</td><td>All attributes in "tag=value" format</td></tr><tr><td>csv</td><td>All attributes in CSV format</td></tr><tr><td>syslog</td><td>Structured syslog</td></tr><tr><td>usyslog</td><td>Unstructured syslog</td></tr><tr><td>json</td><td>JSON</td></tr><tr><td>raw</td><td>Raw binary</td></tr></tbody></table>

## Examples

```
history output-format json
history output-format "%d type=%12t mac=%m? host=%60h?? category=%Mh?"
```

## Related Commands


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.islandrouter.com/island-router-cli-2.3.2/commands/history/history-output-format.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
