pfSense-pkg-RESTAPI

LogFileModelTraits

Defines a set of traits that are intended to be used by Models to read, decompress and process log files.

Table of Contents

Methods

read_log()  : array<string|int, mixed>
Reads all available logs for a given base log file path and returns the contents as an array of lines. Warning: This will include rotated logs, including compressed logs which may have a performance impact.
check_file_exists()  : void
Checks if a given log file exists.
gather_log_filepaths()  : array<string|int, mixed>
Gather all log filepaths for a given base log.
read_bzip2_log()  : array<string|int, mixed>
Decompresses a bzip2 compressed log file and returns the contents as an array of lines.
read_gzip_log()  : array<string|int, mixed>
Decompresses a gzip compressed log file and returns the contents as an array of lines.
read_uncompressed_log()  : array<string|int, mixed>
Reads a given log file with no compression and returns the contents as an array of lines.
read_xz_log()  : array<string|int, mixed>
Decompresses a xz compressed log file and returns the contents as an array of lines.

Methods

read_log()

Reads all available logs for a given base log file path and returns the contents as an array of lines. Warning: This will include rotated logs, including compressed logs which may have a performance impact.

public read_log(string $base_log) : array<string|int, mixed>
Parameters
$base_log : string

The base log file path.

Tags
note

zstd compressed logs are not supported.

Return values
array<string|int, mixed>

An array of all log file contents for the given base log.

check_file_exists()

Checks if a given log file exists.

private check_file_exists(string $filepath) : void
Parameters
$filepath : string

The path to the log file.

Tags
throws
NotFoundError

If the log file does not exist.

gather_log_filepaths()

Gather all log filepaths for a given base log.

private gather_log_filepaths(string $base_log) : array<string|int, mixed>
Parameters
$base_log : string

The base log file path.

Return values
array<string|int, mixed>

An array of all log file paths for the given base log.

read_bzip2_log()

Decompresses a bzip2 compressed log file and returns the contents as an array of lines.

private read_bzip2_log(string $filepath) : array<string|int, mixed>
Parameters
$filepath : string

The path to the log file.

Return values
array<string|int, mixed>

An array of log file contents.

read_gzip_log()

Decompresses a gzip compressed log file and returns the contents as an array of lines.

private read_gzip_log(string $filepath) : array<string|int, mixed>
Parameters
$filepath : string

The path to the log file.

Return values
array<string|int, mixed>

An array of log file contents.

read_uncompressed_log()

Reads a given log file with no compression and returns the contents as an array of lines.

private read_uncompressed_log(string $filepath) : array<string|int, mixed>
Parameters
$filepath : string

The path to the log file.

Return values
array<string|int, mixed>

An array of log file contents.

read_xz_log()

Decompresses a xz compressed log file and returns the contents as an array of lines.

private read_xz_log(string $filepath) : array<string|int, mixed>
Parameters
$filepath : string

The path to the log file.

Return values
array<string|int, mixed>

An array of log file contents.


        
On this page

Search results