Command

The logs command is used to manage and search your installation, or “instance” of Apex Logs.

Environment variables

The following environment variables are used by logs:

  • APEX_LOGS_PROJECT_ID: project id used as the default for --project_id
  • APEX_LOGS_CONFIG: path to Apex Logs configuration, defaults to ~/.apex-logs.json
  • APEX_CONFIG: path to Apex auth configuration, defaults to ~/.apex.json

Usage

The general command usage:

Usage:

logs [<flags>] <command> [<args> ...]

Flags:

-h, --help  Output usage information.

Commands:

help                 Show help for a command.
search               Search log events.
instance install     Install an instance.
instance update      Upgrade an instance.
instance delete      Delete the instance and all log data.
instance open        Open the instance URL in the browser.
instance info        Show information about the instance.
fields               Show discovered log fields.
upgrade              Upgrade the logs command-line program.
version              Show the command version.

Search

Search log events.

Usage:

logs search --project_id=PROJECT_ID [<flags>] [<query>]

Flags:

-h, --help                   Output usage information.
-s, --since="15m"            Show logs since duration (30s, 5m, 2h, 1h30m, 3d, 1M).
-l, --limit=25               Limit the number of events returned.
-p, --project_id=PROJECT_ID  The project to search.
-i, --interactive            Interactive log search.

Args:

[<query>]  Search query string.

Examples:

Show all logs in the past 5 minutes.
$ logs -s 5m

Show error logs in the past day.
$ logs error

Show error logs in the past week.
$ logs error --since 1w

Show bastion node activity since the specified time.
$ logs 'host = "bastion"' --since 'yesterday at 5pm'

Show canceled subscriptions in the past month.
$ logs 'message = "Cancel Subscription"' --since 1M

Show login events for a particular user.
$ logs 'message = "Login" and user.name = "Tobi"' --since '3 days ago'

Fields

Show discovered log fields.

Usage:

logs fields --project_id=PROJECT_ID [<flags>]

Flags:

-h, --help                   Output usage information.
-s, --since="1h"             Show logs since duration (30s, 5m, 2h, 1h30m, 3d, 1M).
-p, --project_id=PROJECT_ID  The project to search.