Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2025.2

# p4 logparse

Parse a structured log file and return log data.

## Syntax

    p4 [g-opts] logparse [-e] [-T fields...] [-F filter] [-s offset] [-m max] logfile

Syntax and naming conventions

## Description

The `p4 logparse` command parses the indicated structured logfile and returns the log data in tagged format.

Structured logs differ from the basic error log (`P4LOG`) and audit log (`P4AUDIT`). To read the basic error log, use the `p4 logtail` command.

Valid names for structured log files:

`all.csv` | All loggable events (commands, errors, audit, etc.)
`audit.csv` | Audit events (audit, purge)
`auth.csv` | Information about user login attempts.
`commands.csv` | Command events (command start, command compute, command end)
`errors.csv` | Error events (errors-failed, errors-fatal)
`events.csv` | Server events, such as startup, shutdown, checkpoint, and journal rotation.
`integrity.csv` | Major events that occur during replica integrity checking.
`ldapsync.csv` | Activity of p4 ldapsync
`route.csv` | Log the full network route of authenticated client connections. Errors related to `net.mimcheck` are also logged against the related hop.
`track.csv` | Command tracking (track-usage, track-rpc, track-db)
`triggers.csv` | Trigger events.
`user.csv` | User events, with one record every time a user runs `p4 logappend`

To enable structured logging, set the `serverlog.file.`n`` configurable(s) to the name of the file. For example:

Copy

    p4 configure set serverlog.file.2=commands.csv
    p4 configure set serverlog.file.3=errors.csv
    p4 configure set serverlog.file.5=audit.csv

Numbers provided for the configurables do not have to be consecutive. A given number cannot exceed 500, so the following assignment returns an error:

    p4 configure set serverlog.file.666=commands.csv

Structured log files are automatically rotated on checkpoint, journal creation, overflow of associated `serverlog.maxmb.`n`` limit (if configured), and the `p4 logrotate` command.

## Options

Option | Description
--- | ---
`-e` | Display special characters as hex-encodings.
`-F filter` | Limit output to records that match the filter pattern.
`-m max` | Limit the number of lines returned.
`-s f_offset` | Start parsing at the given file offset as returned in the `f_offset` field.
`-T `fields...`` | Limit displayed fields to those listed.
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | `super` available to an operator user

## Examples

To match the contents of a particular field, use the field=word syntax. Logical operators & (AND), | (OR), ^ (not), and () (grouping) can

also be used. Spaces are treated as a low-precedence AND operator

OR (|) operator to get the event type and date for both user bruno and user admin: p4 logparse -T 'f_user f_eventtype f_date' -F 'f_user=bruno | f_user=admin' errors.csv
AND (&) operator, NOT (^) operator to get event type and date while excluding the user admin: p4 logparse -T 'f_user f_eventtype f_date' -F 'f_eventtype=4 & ^f_user=admin ' errors.csv The ^ operator can be used only in conjunction with the & or space operators.
wildcard (*) operator matches anything, so mar* will match mary, maria, mark, marcy, marcus: p4 logparse -T 'f_user f_eventtype f_date' -F 'f_user=mar*' errors.csv

## Related commands

To add entries to the log so that p4 logparse can find them. | p4 logappend
Describe the schema of structured log record types. | p4 logschema

Your search for returned results