diff --git a/products/paas/shopware/fundamentals/applications.md b/products/paas/shopware/fundamentals/applications.md index dceeaa3e9..67948708f 100644 --- a/products/paas/shopware/fundamentals/applications.md +++ b/products/paas/shopware/fundamentals/applications.md @@ -76,6 +76,20 @@ Pre-deployment and post-deployment hooks are supported through the [deployment h Automated deployments from CI/CD are supported. The CLI can run in non-interactive mode and supports machine-to-machine authentication with tokens. +You can inspect runtime logs with: + +```sh +sw-paas application logs +``` + +Deployment setup and migration logs are available with: + +```sh +sw-paas application deploy logs +``` + +Both commands print a Grafana Explore URL at the end so you can continue investigating the same logs in Grafana. For more log filtering options, see [Logs](../monitoring/logs). + ## Deploy a specific build of your application To create a deployment with a specific build, use the following command: diff --git a/products/paas/shopware/guides/cronjobs.md b/products/paas/shopware/guides/cronjobs.md index b033e5883..8344987ff 100644 --- a/products/paas/shopware/guides/cronjobs.md +++ b/products/paas/shopware/guides/cronjobs.md @@ -238,13 +238,25 @@ The **Failure Reason** column shows why a run failed. It is only set for entries ### Logs -The full output of each Cron Job execution is available in Grafana. Use the following label filter to find the relevant log entries: +The full output of each Cron Job execution is available through the CLI: -```text -component: cronjob +```bash +sw-paas application cronjob logs +``` + +If you know the run ID, pass it directly: + +```bash +sw-paas application cronjob logs --run-id +``` + +The short alias `cron` is also supported: + +```bash +sw-paas application cron logs ``` -For details on how to access and query logs in Grafana, see [Logs](../monitoring/logs). +The command prints a Grafana Explore URL at the end so you can continue investigating the same cron job run in Grafana. For advanced log filters and Grafana access, see [Logs](../monitoring/logs). ## Specifying Organization, Project, and Application diff --git a/products/paas/shopware/monitoring/logs.md b/products/paas/shopware/monitoring/logs.md index 2ec2ec2b3..9b847a41f 100644 --- a/products/paas/shopware/monitoring/logs.md +++ b/products/paas/shopware/monitoring/logs.md @@ -8,7 +8,153 @@ nav: ## Application Logs -Shopware PaaS Native allows you to view your application’s logs for a given environment via Grafana. +Shopware PaaS Native allows you to query and follow logs for a given application environment directly from the CLI. + +To view recent runtime logs, run: + +```bash +sw-paas application logs +``` + +By default, the command returns the latest logs from the last 15 minutes. If the CLI cannot infer the target from your current git remote, it will ask you to select the organization, project, and application. You can also pass them explicitly: + +```bash +sw-paas application logs \ + --organization-id \ + --project-id \ + --application-id +``` + +After printing the selected logs, the CLI prints a Grafana Explore URL for the same query. Open that URL if you want to continue investigating the result in Grafana. + +### Follow logs + +Use `--follow` or `-f` to stream new log lines: + +```bash +sw-paas application logs --follow +``` + +When following logs, the command starts with new lines only. Add `--since` to include recent history before the live stream begins: + +```bash +sw-paas application logs --follow --since 30m +``` + +### Filter runtime logs + +Use `--component` to focus on a specific application component: + +```bash +sw-paas application logs --component storefront +``` + +Supported components are: + +- `admin` +- `command` +- `cronjob` +- `migration` +- `scheduled-task` +- `setup` +- `storefront` +- `worker` + +Use `--time-range` to inspect a local time window for the current day: + +```bash +sw-paas application logs --time-range 09:00-10:00 +``` + +Use `--limit` to change the maximum number of returned log lines: + +```bash +sw-paas application logs --limit 500 +``` + +For advanced filtering, pass a raw `LogQL` query: + +```bash +sw-paas application logs --query '{job="vector",component="storefront"} |= "error"' +``` + +### Output formats + +Use `--raw` to print only log messages: + +```bash +sw-paas application logs --raw +``` + +Use `--output json` for machine-readable output: + +```bash +sw-paas application logs --output json +``` + +### Specialized log commands + +Deployment setup and migration logs are available through `sw-paas application deployment logs`. The short alias `deploy` is also supported: + +```bash +sw-paas application deploy logs +``` + +If you know the deployment ID, pass it directly: + +```bash +sw-paas application deploy logs --deployment-id +``` + +Add `--follow` or `-f` to stream deployment setup and migration logs. + +Cron job run logs are available through the cronjob logs command: + +```bash +sw-paas application cronjob logs +``` + +If you know the run ID, pass it directly: + +```bash +sw-paas application cronjob logs --run-id +``` + +You can also filter run selection by cron job and control how many history entries are used for selection: + +```bash +sw-paas application cronjob logs \ + --cronjob-id \ + --history-limit 100 +``` + +The short alias `cron` is also supported: + +```bash +sw-paas application cron logs +``` + +Add `--follow` or `-f` to stream logs for the selected cron job run. + +Logs for commands executed in dedicated containers are available through: + +```bash +sw-paas command logs +``` + +If you know the command ID, pass it directly: + +```bash +sw-paas command logs --command-id +``` + +Add `--follow` or `-f` to stream command logs. + +These specialized commands also print a Grafana Explore URL at the end so you can open the same log query in Grafana. + +## Grafana + +You can also view and investigate application logs directly in Grafana. To access Grafana, run the following command: