From e0d71aa9daab3b2545923e24830d4d2e4448dd3c Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Mon, 25 Jul 2016 13:29:19 -0700 Subject: [PATCH] getting started --- website/source/docs/commands/logs.html.md.erb | 2 +- website/source/docs/jobops/logs.html.md | 25 +++++++++++-------- .../intro/getting-started/install.html.md | 1 + .../source/intro/getting-started/jobs.html.md | 10 ++------ .../intro/getting-started/next-steps.html.md | 4 +++ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/website/source/docs/commands/logs.html.md.erb b/website/source/docs/commands/logs.html.md.erb index 91c5dd3d4..a00b12d1c 100644 --- a/website/source/docs/commands/logs.html.md.erb +++ b/website/source/docs/commands/logs.html.md.erb @@ -25,7 +25,7 @@ the given job will be chosen. <%= general_options_usage %> -## Fs Options +## Logs Options * `-stderr`: Display stderr logs. diff --git a/website/source/docs/jobops/logs.html.md b/website/source/docs/jobops/logs.html.md index 9c0035b16..e55423053 100644 --- a/website/source/docs/jobops/logs.html.md +++ b/website/source/docs/jobops/logs.html.md @@ -10,8 +10,10 @@ description: |- Accessing applications logs is critical when debugging issues, performance problems or even for verifying the application is starting correctly. To make -this as simple as possible, Nomad provides both a CLI tool and an API for -accessing application logs and data files. +this as simple as possible, Nomad provides [log +rotation](/docs/jobspec/index.html#log_rotation) in the jobspec, provides a [CLI +command](/docs/commands/logs.html) and an [API](/docs/http/client-fs.html#logs) +for accessing application logs and data files. To see this in action we can just run the example job which created using `nomad init`: @@ -32,18 +34,15 @@ $ nomad run example.nomad ==> Evaluation "7a3b78c0" finished with status "complete" ``` -We can grab the allocation ID from above and use the [`nomad fs` -command](/docs/commands/fs.html) to access the applications logs. Logs are -stored under the following directory structure: -`alloc/logs/..`. Nomad has built in log -rotation, documented in the [Jobspec](/docs/jobspec/index.html#log_rotation). -The index is a monotonically increasing number starting at zero and incremented -each time the log is rotated. +We can grab the allocation ID from above and use the [`nomad logs` +command](/docs/commands/logs.html) to access the applications logs. The `logs` +command supports both displaying the logs as well as following logs, blocking +for more output. Thus to access the `stdout` we can issue the below command: ``` -$ nomad fs c3c58508 alloc/logs/redis.stdout.0 +$ nomad logs c3c58508 redis _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.1 (00000000/0) 64 bit @@ -69,7 +68,11 @@ $ nomad fs c3c58508 alloc/logs/redis.stdout.0 1:M 28 Jun 19:49:30.505 * The server is now ready to accept connections on port 6379 ``` -Replacing `stdout` for `stderr` would display the respective `stderr` output. +To display the `stderr` for the task we would run the following: + +``` +$ nomad logs -stderr c3c58508 redis +``` While this works well for quickly accessing logs, we recommend running a log-shipper for long term storage of logs. In many cases this will not be needed diff --git a/website/source/intro/getting-started/install.html.md b/website/source/intro/getting-started/install.html.md index 36a5ae65e..61713902d 100644 --- a/website/source/intro/getting-started/install.html.md +++ b/website/source/intro/getting-started/install.html.md @@ -55,6 +55,7 @@ Available commands are: fs Inspect the contents of an allocation directory init Create an example job file inspect Inspect a submitted job + logs Streams the logs of a task. node-drain Toggle drain mode on a given node node-status Display status information about nodes plan Dry-run a job update to determine its effects diff --git a/website/source/intro/getting-started/jobs.html.md b/website/source/intro/getting-started/jobs.html.md index 5154c0ddb..3630ba196 100644 --- a/website/source/intro/getting-started/jobs.html.md +++ b/website/source/intro/getting-started/jobs.html.md @@ -105,16 +105,10 @@ We can see that Nomad reports the state of the allocation as well as its current resource usage. By supplying the `-stats` flag, more detailed resource usage statistics will be reported. -To inspect the file system of a running allocation, we can use the [`fs` -command](/docs/commands/fs.html): +To see the logs of a task, we can use the [logs command](/docs/commands/logs.html): ``` -$ nomad fs 8ba85cef alloc/logs -Mode Size Modified Time Name --rw-rw-r-- 0 B 15/03/16 15:40:56 PDT redis.stderr.0 --rw-rw-r-- 2.3 kB 15/03/16 15:40:57 PDT redis.stdout.0 - -$ nomad fs 8ba85cef alloc/logs/redis.stdout.0 +$ nomad logs 8ba85cef redis _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.1 (00000000/0) 64 bit diff --git a/website/source/intro/getting-started/next-steps.html.md b/website/source/intro/getting-started/next-steps.html.md index 33cc2f887..d111e5639 100644 --- a/website/source/intro/getting-started/next-steps.html.md +++ b/website/source/intro/getting-started/next-steps.html.md @@ -20,3 +20,7 @@ We recommend reading the following as next steps. * [Creating a Cluster](/docs/cluster/bootstrapping.html) - Additional details on creating a production worthy Nomad Cluster. + + * [Operating a Job](/docs/jobops/index.html) - Additional details on how to + run a job in production. +