Skip to content

Commit ce7731e

Browse files
author
Imron Alston
committed
Update README.md with info on the download-log command
1 parent b539238 commit ce7731e

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

README.md

+51
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Command-line tool for accessing Scalyr services. The following commands are curr
77
- [**numeric-query**](#fetching-numeric-data): Retrieve numeric / graph data
88
- [**facet-query**](#fetching-facet-counts): Retrieve common values for a field
99
- [**timeseries-query**](#fetching-numeric-data-using-a-timeseries): Retrieve numeric / graph data from a timeseries
10+
- [**download-log**](#downloading-entire-log-files): Download the entire contents of a log file
1011
- [**get-file**](#retrieving-configuration-files): Fetch a configuration file
1112
- [**put-file**](#creating-or-updating-configuration-files): Create or update a configuration file
1213
- [**delete-file**](#creating-or-updating-configuration-files): Delete a configuration file
@@ -163,6 +164,56 @@ these limits.
163164

164165
If the clocks on the servers sending log messages to Scalyr are significantly out of sync then some messages may not appear in the live tail. For example, if you send us a new log message with a timestamp old enough that it's not in the 1,000 most recent messages when it arrives at the Scalyr servers, then it will not be displayed by the live tail tool.
165166

167+
## Downloading entire log files
168+
169+
The "download-log" command allows you to download the entire contents, or a portion, of a log file from a given server host.
170+
171+
The 'download-log' command is similar to the '[query](#querying-logs)' command, except it queries a specific log file from
172+
a specific server host, and it automatically handles continuation tokens so that the entire contents of the log are downloaded
173+
for the specified time range.
174+
175+
**NOTE** this command is mostly intended to simplify retrieval of agent logs and profiling/debug information generated
176+
by the agent. For bulk exports of log data, you are better off using the bulkExport tool: https://www.scalyr.com/bulkExports
177+
178+
Here are some usage examples:
179+
180+
# Download the last 24 hours of the agent.log from prod-100
181+
# Note: the default logfile to download is agent.log
182+
# Also note the default query time range is the previous 24 hours
183+
scalyr download-log --serverHost prod-100
184+
185+
# Download the last 4 hours of the agent.callgrind from prod-100
186+
# Note: if a non-absolute log file is specified, download-log assumes
187+
# the log file location is in /var/log/scalyr-agent-2/
188+
scalyr download-log --serverHost prod-100 --logfile agent.callgrind --start 4h
189+
190+
# Download the last 4 hours of /var/log/nginx/access.log from prod-100
191+
scalyr download-log --serverHost prod-100 --logfile /var/log/nginx/access.log --start 4h
192+
193+
Complete argument list:
194+
195+
scalyr download-log [options...]
196+
197+
--serverHost <SERVERHOST>
198+
the serverHost containing the log file that you wish
199+
to download - cannot be empty
200+
201+
--logfile <LOGFILE>
202+
the logfile on the serverHost that you want to download - defaults to `agent.log`.
203+
If the logfile does not start with a `/` then the logfile is assumed to be
204+
relative to /var/log/scalyr-agent-2
205+
206+
--start <START>
207+
beginning of the time range to query. Uses same syntax as the '[query](#querying-logs)' command.
208+
209+
--end <END>
210+
end of the time range to query. Uses same syntax as the '[query](#querying-logs)' command.
211+
212+
--delay <DELAY>
213+
If multiple queries are needed to retrieve the full contents, the number of seconds to delay
214+
between continuation queries. Defaults to 0.
215+
216+
166217
## Fetching numeric data
167218

168219
The "numeric-query" command allows you to retrieve numeric data, e.g. for graphing. You can count the

scalyr

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def commandDownloadLog(parser):
232232
parser.add_argument('--serverHost', default='',
233233
help='the serverHost containing the log file that you wish to download - cannot be empty')
234234
parser.add_argument('--logfile', default='agent.log',
235-
help='the logfile on the serverHost that you want to download - cannot be empty. If the logfile does '
235+
help='the logfile on the serverHost that you want to download - defaults to agent.log. If the logfile does '
236236
'not start with a `/` then the logfile is assumed to be relative to /var/log/scalyr-agent-2')
237237
parser.add_argument('--start', default='',
238238
help='beginning of the time range to query')

0 commit comments

Comments
 (0)