LogoLogo
Studio
4.3
4.3
  • HarperDB Docs
  • Getting Started
  • Developers
    • Applications
      • Caching
      • Defining Schemas
      • Debugging Applications
      • Define Fastify Routes
      • Example Projects
    • Components
      • Installing
      • Writing Extensions
      • Operations
      • Google Data Studio
      • SDKs
      • Drivers
    • REST
    • Operations API
      • Quick Start Examples
      • Databases and Tables
      • NoSQL Operations
      • Bulk Operations
      • Users and Roles
      • Clustering
      • Custom Functions
      • Components
      • Registration
      • Jobs
      • Logs
      • Utilities
      • Token Authentication
      • SQL Operations
      • Advanced JSON SQL Examples
    • Real-Time
    • Clustering
      • Requirements and Definitions
      • Creating A Cluster User
      • Naming A Node
      • Enabling Clustering
      • Establishing Routes
      • Subscription Overview
      • Managing Subscriptions
      • Things Worth Knowing
      • Certificate Management
    • Security
      • JWT Authentication
      • Basic Authentication
      • mTLS Authentication
      • Configuration
      • Users & Roles
      • Certificate Management
    • SQL Guide
      • SQL Features Matrix
      • SQL Date Functions
      • SQL Reserved Word
      • SQL Functions
      • SQL JSON Search
      • SQL Geospatial Functions
  • Administration
    • Best Practices and Recommendations
    • Logging
      • Standard Logging
      • Audit Logging
      • Transaction Logging
    • Clone Node
    • Compact
    • Jobs
    • HarperDB Studio
      • Create an Account
      • Log In & Password Reset
      • Organizations
      • Instances
      • Query Instance Data
      • Manage Databases / Browse Data
      • Manage Charts
      • Manage Clustering
      • Manage Instance Users
      • Manage Instance Roles
      • Manage Applications
      • Instance Metrics
      • Instance Configuration
      • Enable Mixed Content
  • Deployments
    • Configuration File
    • HarperDB CLI
    • Install HarperDB
      • On Linux
    • Upgrade a HarperDB Instance
    • HarperDB Cloud
      • IOPS Impact on Performance
      • Instance Size Hardware Specs
      • Alarms
      • Verizon 5G Wavelength
  • Technical Details
    • Reference
      • Analytics
      • Architecture
      • Content Types
      • Data Types
      • Dynamic Schema
      • HarperDB Headers
      • HarperDB Limits
      • Globals
      • Resource Class
      • Transactions
      • Storage Algorithm
    • Release Notes
      • HarperDB Tucker (Version 4)
        • 4.3.36
        • 4.3.35
        • 4.3.34
        • 4.3.33
        • 4.3.32
        • 4.3.31
        • 4.3.30
        • 4.3.29
        • 4.3.28
        • 4.3.27
        • 4.3.26
        • 4.3.25
        • 4.3.24
        • 4.3.23
        • 4.3.22
        • 4.3.21
        • 4.3.20
        • 4.3.19
        • 4.3.18
        • 4.3.17
        • 4.3.16
        • 4.3.15
        • 4.3.14
        • 4.3.13
        • 4.3.12
        • 4.3.11
        • 4.3.10
        • 4.3.9
        • 4.3.8
        • 4.3.7
        • 4.3.6
        • 4.3.5
        • 4.3.4
        • 4.3.3
        • 4.3.2
        • 4.3.1
        • 4.3.0
        • 4.2.8
        • 4.2.7
        • 4.2.6
        • 4.2.5
        • 4.2.4
        • 4.2.3
        • 4.2.2
        • 4.2.1
        • 4.2.0
        • 4.1.2
        • 4.1.1
        • 4.1.0
        • 4.0.7
        • 4.0.6
        • 4.0.5
        • 4.0.4
        • 4.0.3
        • 4.0.2
        • 4.0.1
        • 4.0.0
        • HarperDB Monkey (Version 3)
        • 3.3.0
        • 3.2.1
        • 3.2.0
        • 3.1.5
        • 3.1.4
        • 3.1.3
        • 3.1.2
        • 3.1.1
        • 3.1.0
        • 3.0.0
        • HarperDB Penny (Version 2)
        • 2.3.1
        • 2.3.0
        • 2.2.3
        • 2.2.2
        • 2.2.0
        • 2.1.1
        • HarperDB Alby (Version 1)
        • 1.3.1
        • 1.3.0
        • 1.2.0
        • 1.1.0
  • More Help
    • Support
    • Slack
    • Contact Us
Powered by GitBook
On this page
  • Read HarperDB Log
  • Body
  • Response: 200
  • Read Transaction Log
  • Body
  • Response: 200
  • Delete Transaction Logs Before
  • Body
  • Response: 200
  • Read Audit Log
  • Body
  • Response: 200
  • Read Audit Log by timestamp
  • Body
  • Response: 200
  • Read Audit Log by username
  • Body
  • Response: 200
  • Read Audit Log by hash_value
  • Body
  • Response: 200
  • Delete Audit Logs Before
  • Body
  • Response: 200
  1. Developers
  2. Operations API

Logs

Read HarperDB Log

Returns log outputs from the primary HarperDB log based on the provided search criteria. Read more about HarperDB logging here: https://docs.harperdb.io/docs/logging#read-logs-via-the-api.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_Log

  • start (optional) - result to start with. Default is 0, the first log in hdb.log. Must be a number

  • limit (optional) - number of results returned. Default behavior is 1000. Must be a number

  • level (optional) - error level to filter on. Default behavior is all levels. Must be notify, error, warn, info, debug or trace

  • from (optional) - date to begin showing log results. Must be YYYY-MM-DD or YYYY-MM-DD hh:mm:ss. Default is first log in hdb.log

  • until (optional) - date to end showing log results. Must be YYYY-MM-DD or YYYY-MM-DD hh:mm:ss. Default is last log in hdb.log

  • order (optional) - order to display logs desc or asc by timestamp. By default, will maintain hdb.log order

Body

{
    "operation": "read_log",
    "start": 0,
    "limit": 1000,
    "level": "error",
    "from": "2021-01-25T22:05:27.464+0000",
    "until": "2021-01-25T23:05:27.464+0000",
    "order": "desc"
}

Response: 200

[
    {
        "level": "notify",
        "message": "Connected to cluster server.",
        "timestamp": "2021-01-25T23:03:20.710Z",
        "thread": "main/0",
        "tags": []
    },
    {
        "level": "warn",
        "message": "Login failed",
        "timestamp": "2021-01-25T22:24:45.113Z",
        "thread": "http/9",
        "tags": []
    },
    {
        "level": "error",
        "message": "unknown attribute 'name and breed'",
        "timestamp": "2021-01-25T22:23:24.167Z",
        "thread": "http/9",
        "tags": []
    }
]

Read Transaction Log

Returns all transactions logged for the specified database table. You may filter your results with the optional from, to, and limit fields. Read more about HarperDB transaction logs here: https://docs.harperdb.io/docs/transaction-logging#read_transaction_log.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_transaction_log

  • schema (required) - schema under which the transaction log resides

  • table (required) - table under which the transaction log resides

  • from (optional) - time format must be millisecond-based epoch in UTC

  • to (optional) - time format must be millisecond-based epoch in UTC

  • limit (optional) - max number of logs you want to receive. Must be a number

Body

{
    "operation": "read_transaction_log",
    "schema": "dev",
    "table": "dog",
    "from": 1560249020865,
    "to": 1660585656639,
    "limit": 10
}

Response: 200

[
    {
        "operation": "insert",
        "user": "admin",
        "timestamp": 1660165619736,
        "records": [
            {
                "id": 1,
                "dog_name": "Penny",
                "owner_name": "Kyle",
                "breed_id": 154,
                "age": 7,
                "weight_lbs": 38,
                "__updatedtime__": 1660165619688,
                "__createdtime__": 1660165619688
            }
        ]
    },
    {
        "operation": "insert",
        "user": "admin",
        "timestamp": 1660165619813,
        "records": [
            {
                "id": 2,
                "dog_name": "Harper",
                "owner_name": "Stephen",
                "breed_id": 346,
                "age": 7,
                "weight_lbs": 55,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 3,
                "dog_name": "Alby",
                "owner_name": "Kaylan",
                "breed_id": 348,
                "age": 7,
                "weight_lbs": 84,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 4,
                "dog_name": "Billy",
                "owner_name": "Zach",
                "breed_id": 347,
                "age": 6,
                "weight_lbs": 60,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 5,
                "dog_name": "Rose Merry",
                "owner_name": "Zach",
                "breed_id": 348,
                "age": 8,
                "weight_lbs": 15,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 6,
                "dog_name": "Kato",
                "owner_name": "Kyle",
                "breed_id": 351,
                "age": 6,
                "weight_lbs": 32,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 7,
                "dog_name": "Simon",
                "owner_name": "Fred",
                "breed_id": 349,
                "age": 3,
                "weight_lbs": 35,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 8,
                "dog_name": "Gemma",
                "owner_name": "Stephen",
                "breed_id": 350,
                "age": 5,
                "weight_lbs": 55,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 9,
                "dog_name": "Yeti",
                "owner_name": "Jaxon",
                "breed_id": 200,
                "age": 5,
                "weight_lbs": 55,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 10,
                "dog_name": "Monkey",
                "owner_name": "Aron",
                "breed_id": 271,
                "age": 7,
                "weight_lbs": 35,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 11,
                "dog_name": "Bode",
                "owner_name": "Margo",
                "breed_id": 104,
                "age": 8,
                "weight_lbs": 75,
                "adorable": true,
                "__updatedtime__": 1660165619797,
                "__createdtime__": 1660165619797
            },
            {
                "id": 12,
                "dog_name": "Tucker",
                "owner_name": "David",
                "breed_id": 346,
                "age": 2,
                "weight_lbs": 60,
                "adorable": true,
                "__updatedtime__": 1660165619798,
                "__createdtime__": 1660165619798
            },
            {
                "id": 13,
                "dog_name": "Jagger",
                "owner_name": "Margo",
                "breed_id": 271,
                "age": 7,
                "weight_lbs": 35,
                "adorable": true,
                "__updatedtime__": 1660165619798,
                "__createdtime__": 1660165619798
            }
        ]
    },
    {
        "operation": "update",
        "user": "admin",
        "timestamp": 1660165620040,
        "records": [
            {
                "id": 1,
                "dog_name": "Penny B",
                "__updatedtime__": 1660165620036
            }
        ]
    }
]

Delete Transaction Logs Before

Deletes transaction log data for the specified database table that is older than the specified timestamp.

Operation is restricted to super_user roles only

  • operation (required) - must always be delete_transaction_log_before

  • schema (required) - schema under which the transaction log resides. Must be a string

  • table (required) - table under which the transaction log resides. Must be a string

  • timestamp (required) - records older than this date will be deleted. Format is millisecond-based epoch in UTC

Body

{
    "operation": "delete_transaction_logs_before",
    "schema": "dev",
    "table": "dog",
    "timestamp": 1598290282817
}

Response: 200

{
    "message": "Starting job with id 26a6d3a6-6d77-40f9-bee7-8d6ef479a126"
}

Read Audit Log

AuditLog must be enabled in the HarperDB configuration file to make this request. Returns a verbose history of all transactions logged for the specified database table, including original data records. You may filter your results with the optional search_type and search_values fields. Read more about HarperDB transaction logs here: https://docs.harperdb.io/docs/transaction-logging#read_audit_log.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_audit_log

  • schema (required) - schema under which the transaction log resides

  • table (required) - table under which the transaction log resides

  • search_type (optional) - possibilities are hash_value, timestamp and username

  • search_values (optional) - an array of string or numbers relating to search_type

Body

{
    "operation": "read_audit_log",
    "schema": "dev",
    "table": "dog"
}

Response: 200

[
    {
        "operation": "insert",
        "user_name": "admin",
        "timestamp": 1660585635882.288,
        "hash_values": [
            318
        ],
        "records": [
            {
                "id": 318,
                "dog_name": "Polliwog",
                "__updatedtime__": 1660585635876,
                "__createdtime__": 1660585635876
            }
        ]
    },
    {
        "operation": "insert",
        "user_name": "admin",
        "timestamp": 1660585716133.01,
        "hash_values": [
            444
        ],
        "records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585716128,
                "__createdtime__": 1660585716128
            }
        ]
    },
    {
        "operation": "update",
        "user_name": "admin",
        "timestamp": 1660585740558.415,
        "hash_values": [
            444
        ],
        "records": [
            {
                "id": 444,
                "fur_type": "coarse",
                "__updatedtime__": 1660585740556
            }
        ],
        "original_records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585716128,
                "__createdtime__": 1660585716128
            }
        ]
    },
    {
        "operation": "delete",
        "user_name": "admin",
        "timestamp": 1660585759710.56,
        "hash_values": [
            444
        ],
        "original_records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585740556,
                "__createdtime__": 1660585716128,
                "fur_type": "coarse"
            }
        ]
    }
]

Read Audit Log by timestamp

AuditLog must be enabled in the HarperDB configuration file to make this request. Returns the transactions logged for the specified database table between the specified time window. Read more about HarperDB transaction logs here: https://docs.harperdb.io/docs/transaction-logging#read_audit_log.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_audit_log

  • schema (required) - schema under which the transaction log resides

  • table (required) - table under which the transaction log resides

  • search_type (optional) - timestamp

  • search_values (optional) - an array containing a maximum of two values [from_timestamp, to_timestamp] defining the range of transactions you would like to view.

    • Timestamp format is millisecond-based epoch in UTC

    • If no items are supplied then all transactions are returned

    • If only one entry is supplied then all transactions after the supplied timestamp will be returned

Body

{
    "operation": "read_audit_log",
    "schema": "dev",
    "table": "dog",
    "search_type": "timestamp",
    "search_values": [
        1660585740558,
        1660585759710.56
    ]
}

Response: 200

[
    {
        "operation": "insert",
        "user_name": "admin",
        "timestamp": 1660585635882.288,
        "hash_values": [
            318
        ],
        "records": [
            {
                "id": 318,
                "dog_name": "Polliwog",
                "__updatedtime__": 1660585635876,
                "__createdtime__": 1660585635876
            }
        ]
    },
    {
        "operation": "insert",
        "user_name": "admin",
        "timestamp": 1660585716133.01,
        "hash_values": [
            444
        ],
        "records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585716128,
                "__createdtime__": 1660585716128
            }
        ]
    },
    {
        "operation": "update",
        "user_name": "admin",
        "timestamp": 1660585740558.415,
        "hash_values": [
            444
        ],
        "records": [
            {
                "id": 444,
                "fur_type": "coarse",
                "__updatedtime__": 1660585740556
            }
        ],
        "original_records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585716128,
                "__createdtime__": 1660585716128
            }
        ]
    },
    {
        "operation": "delete",
        "user_name": "admin",
        "timestamp": 1660585759710.56,
        "hash_values": [
            444
        ],
        "original_records": [
            {
                "id": 444,
                "dog_name": "Davis",
                "__updatedtime__": 1660585740556,
                "__createdtime__": 1660585716128,
                "fur_type": "coarse"
            }
        ]
    },
    {
        "operation": "update",
        "user_name": "admin",
        "timestamp": 1660586298457.224,
        "hash_values": [
            318
        ],
        "records": [
            {
                "id": 318,
                "fur_type": "super fluffy",
                "__updatedtime__": 1660586298455
            }
        ],
        "original_records": [
            {
                "id": 318,
                "dog_name": "Polliwog",
                "__updatedtime__": 1660585635876,
                "__createdtime__": 1660585635876
            }
        ]
    }
]

Read Audit Log by username

AuditLog must be enabled in the HarperDB configuration file to make this request. Returns the transactions logged for the specified database table which were committed by the specified user. Read more about HarperDB transaction logs here: https://docs.harperdb.io/docs/transaction-logging#read_audit_log.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_audit_log

  • schema (required) - schema under which the transaction log resides

  • table (required) - table under which the transaction log resides

  • search_type (optional) - username

  • search_values (optional) - the HarperDB user for whom you would like to view transactions

Body

{
    "operation": "read_audit_log",
    "schema": "dev",
    "table": "dog",
    "search_type": "username",
    "search_values": [
        "admin"
    ]
}

Response: 200

{
    "admin": [
        {
            "operation": "insert",
            "user_name": "admin",
            "timestamp": 1660585635882.288,
            "hash_values": [
                318
            ],
            "records": [
                {
                    "id": 318,
                    "dog_name": "Polliwog",
                    "__updatedtime__": 1660585635876,
                    "__createdtime__": 1660585635876
                }
            ]
        },
        {
            "operation": "insert",
            "user_name": "admin",
            "timestamp": 1660585716133.01,
            "hash_values": [
                444
            ],
            "records": [
                {
                    "id": 444,
                    "dog_name": "Davis",
                    "__updatedtime__": 1660585716128,
                    "__createdtime__": 1660585716128
                }
            ]
        },
        {
            "operation": "update",
            "user_name": "admin",
            "timestamp": 1660585740558.415,
            "hash_values": [
                444
            ],
            "records": [
                {
                    "id": 444,
                    "fur_type": "coarse",
                    "__updatedtime__": 1660585740556
                }
            ],
            "original_records": [
                {
                    "id": 444,
                    "dog_name": "Davis",
                    "__updatedtime__": 1660585716128,
                    "__createdtime__": 1660585716128
                }
            ]
        },
        {
            "operation": "delete",
            "user_name": "admin",
            "timestamp": 1660585759710.56,
            "hash_values": [
                444
            ],
            "original_records": [
                {
                    "id": 444,
                    "dog_name": "Davis",
                    "__updatedtime__": 1660585740556,
                    "__createdtime__": 1660585716128,
                    "fur_type": "coarse"
                }
            ]
        },
        {
            "operation": "update",
            "user_name": "admin",
            "timestamp": 1660586298457.224,
            "hash_values": [
                318
            ],
            "records": [
                {
                    "id": 318,
                    "fur_type": "super fluffy",
                    "__updatedtime__": 1660586298455
                }
            ],
            "original_records": [
                {
                    "id": 318,
                    "dog_name": "Polliwog",
                    "__updatedtime__": 1660585635876,
                    "__createdtime__": 1660585635876
                }
            ]
        }
    ]
}

Read Audit Log by hash_value

AuditLog must be enabled in the HarperDB configuration file to make this request. Returns the transactions logged for the specified database table which were committed to the specified hash value(s). Read more about HarperDB transaction logs here: https://docs.harperdb.io/docs/transaction-logging#read_audit_log.

Operation is restricted to super_user roles only

  • operation (required) - must always be read_audit_log

  • schema (required) - schema under which the transaction log resides

  • table (required) - table under which the transaction log resides

  • search_type (optional) - hash_value

  • search_values (optional) - an array of hash_attributes for which you wish to see transaction logs

Body

{
    "operation": "read_audit_log",
    "schema": "dev",
    "table": "dog",
    "search_type": "hash_value",
    "search_values": [
        318
    ]
}

Response: 200

{
    "318": [
        {
            "operation": "insert",
            "user_name": "admin",
            "timestamp": 1660585635882.288,
            "records": [
                {
                    "id": 318,
                    "dog_name": "Polliwog",
                    "__updatedtime__": 1660585635876,
                    "__createdtime__": 1660585635876
                }
            ]
        },
        {
            "operation": "update",
            "user_name": "admin",
            "timestamp": 1660586298457.224,
            "records": [
                {
                    "id": 318,
                    "fur_type": "super fluffy",
                    "__updatedtime__": 1660586298455
                }
            ],
            "original_records": [
                {
                    "id": 318,
                    "dog_name": "Polliwog",
                    "__updatedtime__": 1660585635876,
                    "__createdtime__": 1660585635876
                }
            ]
        }
    ]
}

Delete Audit Logs Before

AuditLog must be enabled in the HarperDB configuration file to make this request. Deletes audit log data for the specified database table that is older than the specified timestamp.

Operation is restricted to super_user roles only

  • operation (required) - must always be delete_audit_logs_before

  • schema (required) - schema under which the transaction log resides. Must be a string

  • table (required) - table under which the transaction log resides. Must be a string

  • timestamp (required) - records older than this date will be deleted. Format is millisecond-based epoch in UTC

Body

{
    "operation": "delete_audit_logs_before",
    "schema": "dev",
    "table": "dog",
    "timestamp": 1660585759710.56
}

Response: 200

{
    "message": "Starting job with id 7479e5f8-a86e-4fc9-add7-749493bc100f"
}
PreviousJobsNextUtilities

Last updated 8 months ago