jsonfile

Loads data in a new line delimited JSON file. The keys are used as field names, and the values are used as field values.

Syntax

jsonfile [OPTIONS] PATH
Required Parameter
PATH
Path to the file from which you want to load the data. If you use a wildcard (*) in the file name, you can load all files containing a specific string pattern in the file name at once. To load the file, the Logpresso daemon must have the read permission to the file.
Optional Parameter
limit=INT
Maximum number of JSON entries to load (default: unlimited). The command distinguishes records using newline characters (CRLF or LF).
offset=INT
Number of records to skip (default: 0).
overlay=BOOL
Output option for JSON source data (default: f).
  • t: Outputs the parsed data to the fields, and the JSON original data to the line field
  • f: outputs only the parsed data to the fields

Usage

  1. Read the /opt/logpresso/wp-nginx.json file.

        # Download: https://raw.githubusercontent.com/logpresso/dataset/main/wp-nginx.json
        | jsonfile /opt/logpresso/wp-nginx.json
    
  2. Read 20 records after skipping the first line of /opt/logpresso/wp-nginx.json file.

    jsonfile offset=1 limit=20 /opt/logpresso/wp-nginx.json
    
  3. Read the /opt/logpresso/wp-nginx.json and import the JSON original data to the line field.

    jsonfile overlay=t /opt/logpresso/wp-nginx.json