zipfile

Retrieves text from a ZIP archive.

Command properties

PropertyDescription
Command typeDriver query
Required permissionLocal file read access
License usageCounted
Parallel executionNot supported
Distributed executionNot supported

Syntax

zipfile [offset=INT] [limit=INT] PATH ENTRY

Options

offset=INT
Number of records to skip.
limit=INT
Maximum number of records to retrieve.

Target

PATH
ZIP file path.
ENTRY
Path of the entry (file) within the ZIP archive.

Output fields

FieldTypeDescription
linestringOriginal line read from the text file
_filestringZIP file path
_entrystringZIP entry path
_timetimestampTimestamp (current time)

Error codes

Parsing errors
Error codeMessageDescription
14002-No file path or entry path was specified
14000-The file does not exist or cannot be read
14001-The parent directory does not exist or cannot be read
14003-Access to the file was denied

Description

The zipfile command retrieves data from text files compressed in a ZIP archive. It returns each line of the specified entry as a record with the content stored in the line field. When a wildcard (*) is used in PATH, multiple ZIP files are processed in order.

Examples

  1. Retrieve text from a file inside a ZIP archive

    zipfile /opt/logpresso/data/logs.zip access.log
    

    Retrieves the access.log entry inside logs.zip line by line.

  2. Retrieve with a record count limit

    zipfile limit=100 /opt/logpresso/data/logs.zip error.log
    

    Retrieves up to 100 records from the error.log entry.