40% off on Spike Billing!

Logs API

This allows you to retrieve the logs from a given file that are filtered by the given query parameters.

GET {logViewer}/api/logs

Request parameters:

host(string) The host.identifier of the host where you want to search. If left empty/null, searches the local host. Only available since version 2.2
file(string) The file.identifier where to search for the logs. If left empty/null, searches all logs.
direction(string) Sorts the results by their timestamp. Allowed values are asc and desc. Default: desc.
query(string) Search query.
levels(array) An array of severity levels to search the logs for. Available values: 'debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency', 'processing', 'processed' and 'failed'.
shorter_stack_traces(boolean) Whether to shorten the stack traces as configured in config/log-viewer.php
page(int) Pagination, current page.
per_page(int) Pagination, number of items per page.

Here's an example request body to get only "error" and "warning" logs from laravel.log, ordered by latest first:

{    "file": "laravel.log",    "levels": ["warning", "error"],}

Log file identifiers have prefixes, like aq4jdh5g-laravel.log, where aq4jdh5g- is the prefix and laravel.log is the file name in the system.

This is needed to differentiate between two files with the same name but in different folders/locations.

You can skip the identifier in the "file" property and just ask for logs from laravel.log, but it will then return results from the first file found with that name.


If you have any questions, feedback, or need any help setting up Log Viewer within your project, feel free to reach out via GitHub Discussions or GitHub Issues .