logs command is used to manage and search your installation, or “instance” of Apex Logs.
The following environment variables are used by
APEX_LOGS_PROJECT_ID: project id used as the default for
APEX_LOGS_CONFIG: path to Apex Logs configuration, defaults to ~/.apex-logs.json
APEX_CONFIG: path to Apex auth configuration, defaults to ~/.apex.json
The general command usage:
logs [<flags>] <command> [<args> ...]
-h, --help Output usage information.
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 log events.
logs search --project_id=PROJECT_ID [<flags>] [<query>]
-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.
[<query>] Search query string.
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'
Show discovered log fields.
logs fields --project_id=PROJECT_ID [<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.