1SG_LOGS(8)                         SG3_UTILS                        SG_LOGS(8)
2
3
4

NAME

6       sg_logs - access log pages with SCSI LOG SENSE command
7

SYNOPSIS

9       sg_logs  [--all]  [--brief]  [--control=PC]  [--help]  [--hex] [--list]
10       [--maxlen=LEN] [--name] [--page=PG[,SPG]] [--paramp=PP] [--pcb] [--ppc]
11       [--raw]   [--reset]  [--select]  [--sp]  [--temperature]  [--transport]
12       [--verbose] [--version] DEVICE
13
14       sg_logs [-a] [-A] [-b]  [-c=PC]  [-h]  [-H]  [-l]  [-L]  [-m=LEN]  [-n]
15       [-p=PG[,SPG]] [-paramp=PP] [-pcb] [-ppc] [-r] [-select] [-sp] [-t] [-T]
16       [-v] [-V] [-?]  DEVICE
17

DESCRIPTION

19       This utility sends a SCSI LOG SENSE command to the DEVICE and then out‐
20       puts  the  response.  The LOG SENSE command is used to fetch log pages.
21       Known log pages  are  decoded  by  default.  When  the  --reset  and/or
22       --select  option  is  given then a SCSI LOG SELECT command is issued to
23       reset parameters (e.g. counters).
24
25       In SPC-4 revision 5 a subpage code was introduced to both the LOG SENSE
26       and  LOG  SELECT command. At the same time a page code field was intro‐
27       duced to the to the LOG SELECT command. The log subpage code can  range
28       from  0  to  255  (0xff)  inclusive.  The subpage code value 255 can be
29       thought of as a wildcard.
30
31       This utility supports two command line syntaxes, the preferred  one  is
32       shown first in the synopsis and explained in this section. A later sec‐
33       tion on the old command  line  syntax  outlines  the  second  group  of
34       options.
35

OPTIONS

37       Arguments to long options are mandatory for short options as well.
38
39       -a, --all
40              outputs all the log pages supported by the device. This requires
41              a two stage process: first the "supported log pages" log page is
42              fetched,  then for each entry in the response, the corresponding
43              log page is fetched and displayed.  When used twice (e.g. '-aa')
44              all log pages and subpages are fetched.
45
46       -b, --brief
47              shorten the amount of output for some log pages. For example the
48              Tape Alert log page only outputs parameters whose flags are  set
49              when --brief is given.
50
51       -c, --control=PC
52              accepts 0, 1, 2 or 3 for the PC argument:
53                0 : current threshold values
54                1 : current cumulative values
55                2 : default threshold values
56                3 : default cumulative values
57              The default value is 1 (i.e. current cumulative values).
58
59       -h, --help
60              print out the usage message then exit.
61
62       -H, --hex
63              The  default  action  is  to decode known mode page numbers (and
64              subpage numbers) into text. When this option is used  once,  the
65              response is output in hexadecimal.
66
67       -l, --list
68              lists  the  names  of  all  logs  sense  pages supported by this
69              device. This is done by reading the "supported  log  pages"  log
70              page.  When  used twice (e.g. '-ll') lists the names of all logs
71              sense pages and subpages supported by this device.  There  is  a
72              list of common log page codes below.
73
74       -m, --maxlen=LEN
75              sets  the "allocation length" field in the LOG SENSE cdb. The is
76              the maximum length in bytes that the response will  be.  Without
77              this option (or LEN equal to 0) this utility first fetches the 4
78              byte response then does a second access with  the  length  indi‐
79              cated  in the first (4 byte) response. Negative values and 1 for
80              LEN  are  not  accepted.  LEN  cannot  exceed  65535   (0xffff).
81              Responses  can  be quite large (e.g. the background scan results
82              log page) and this option can be used to  limit  the  amount  of
83              information returned.
84
85       -n, --name
86              decode  some  log pages into 'name=value' entries, one per line.
87              The name contains no space and may be abbreviated and the  value
88              is  decimal  unless  prefixed  by  '0x'. Nesting is indicated by
89              leading spaces. This form is meant  to  be  relatively  easy  to
90              parse.
91
92       -O, --old
93              Switch to older style options. Please use as first option.
94
95       -p, --page=PG[,SPG]
96              log  page  code to access. PG is expected to be a decimal number
97              between 0 and 63 inclusive. A hexadecimal number can  be  speci‐
98              fied  by a leading "0x" or a trailing "h". Common log page codes
99              are listed below. Optionally SPG, a subpage code, can be  given.
100              SPG  is expected to be a decimal number between 0 and 255 inclu‐
101              sive.
102
103       -P, --paramp=PP
104              PP is the parameter pointer value to place in a  field  of  that
105              name  in  the  LOG SENSE cdb. A decimal number in the range 0 to
106              65535 (0xffff) is expected. When a value greater than 0 is given
107              the --ppc option should be selected. The default value is 0.
108
109       -q, --pcb
110              show  Parameter  Control  Byte  settings (only relevant when log
111              parameters being output in ASCII).
112
113       -Q, --ppc
114              sets the Parameter Pointer Control (PPC) bit in  the  LOG  SENSE
115              cdb. Default is 0 (i.e. cleared).
116
117       -r, --raw
118              output  the  response  in  binary  to stdout. Error messages and
119              warnings are output to stderr.
120
121       -R, --reset
122              use SCSI LOG SELECT command (PCR bit set) to reset the  all  log
123              pages  (or  the  given  page). [SPC-4 (rev 6) doesn't say that a
124              given log (sub)page can be reset yet.]  Exactly  what  is  reset
125              depends  on  the  accompanying  SP  bit  (i.e. --sp option which
126              defaults to 0) and the PC ("page control") value (which defaults
127              to  1).  Supplying  this  option  implies the --select option as
128              well. This option seems to clear error  counter  log  pages  but
129              leaves  pages  like  self-test results, start-stop cycle counter
130              and  temperature  log  pages  unaffected.  This  option  may  be
131              required  to  clear  log  pages if a counter reaches its maximum
132              value since the log page in which  the  counter  is  found  will
133              remain "stuck" until something is done.
134
135       -S, --select
136              use  a LOG SELECT command. The default action (i.e. when neither
137              this option nor --reset is given) is to do a LOG SENSE  command.
138              When  this  option  is given, the SP bit (i.e. --sp option which
139              defaults to 0), the PC ("page control") value (which defaults to
140              1)  and  the  PCR bit (i.e.  --reset option which defaults to 0)
141              are placed in the LOG SELECT cdb. At some stage the log page and
142              subpage  options  may  also be active [but SPC-4 (rev 6) doesn't
143              say that].
144
145       -s, --sp
146              sets  the  Saving  Parameters  (SP)  bit.  Default  is  0  (i.e.
147              cleared).  When  set this instructs the device to store the cur‐
148              rent log page parameters (as indicated by the DS and TSD parame‐
149              ter codes) in some non-volatile location.  Hence the log parame‐
150              ters will be preserved across power cycles. This option is typi‐
151              cally  not  needed, especially if the GLTSD flag is clear in the
152              control mode page as this instructs the device  to  periodically
153              save all saveable log parameters to non-volatile locations.
154
155       -t, --temperature
156              outputs the temperature. First looks in the temperature log page
157              and if that is not available tries the Informational  Exceptions
158              log page which may also have the current temperature (especially
159              on older disks).
160
161       -T, --transport
162              outputs the  transport  ('Protocol  specific  port')  log  page.
163              Equivalent to setting '--page=18h'.
164
165       -v, --verbose
166              increase level of verbosity.
167
168       -V, --version
169              print out version string then exit.
170

NOTES

172       This  utility will usually do a double fetch of log pages with the SCSI
173       LOG SENSE command. The first fetch requests a  4  byte  response  (i.e.
174       place  4  in  the  "allocation  length"  field  in  the cdb). From that
175       response it can calculate the actual length of the  response  which  is
176       what  it asks for on the second fetch. This is typical practice in SCSI
177       and guaranteed to work in the standards.  However  some  older  devices
178       don't comply. For those devices using the --maxlen=LEN option will do a
179       single fetch.  A value of 252 should be a safe starting point.
180
181       Various log pages hold information  error  rates,  device  temperature,
182       start  stop cycles since device produced and the results of the last 20
183       self tests. Self tests can be initiated by the sg_senddiag(8)  utility.
184       The  smartmontools  package provides much of the information found with
185       sg_logs in a form suitable for monitoring the health of SCSI disks  and
186       tape drives.
187
188       Here is a list of log pages that are decoded by this utility. [The code
189       values can be given to '--page=' as is, with a trailing "h" instead  of
190       the leading "0x", or as their decimal equivalents.]:
191
192       0x0       Supported log pages
193       0x0,0xff  Supported log pages and subpages
194       0x1       Buffer overrun/underrun
195       0x2       Write error counter
196       0x3       Read error counter
197       0x4       Read reverse error counter
198       0x5       Verify error counter
199       0x6       Non-medium error
200       0x7       Last n error events
201       0x8       Format status (sbc-2)
202       0xb       Last n deferred errors or asynchronous events
203       0xc        Logical  block  provisioning  (sbc-3)  or  Sequential access
204       device (ssc-2)
205       0xd       Temperature
206       0xe       Start-stop cycle counter
207       0x10      Self-test results
208       0x11      Solid state media
209       0x15      Background scan results (sbc-3)
210       0x16      ATA pass-through results (sat-3)
211       0x17      Non-volatile cache (sbc-3)
212       0x18      Protocol specific port (SAS transport)
213       0x19      General statistics and performance
214       0x1a      Power condition transitions
215       0x2f      Informational exceptions
216       0x37      Seagate cache (vendor, disk)
217       0x3e      Seagate factory (vendor, disk)
218
219       In the 2.4 series of Linux kernels the DEVICE must be  a  SCSI  generic
220       (sg)  device.  In the 2.6 series block devices (e.g. SCSI disks and DVD
221       drives) can also be specified. For example "sg_logs -a  /dev/sda"  will
222       work in the 2.6 series kernels.
223

EXIT STATUS

225       The  exit  status  of sg_logs is 0 when it is successful. Otherwise see
226       the sg3_utils(8) man page.
227

OLDER COMMAND LINE OPTIONS

229       The options in this section were  the  only  ones  available  prior  to
230       sg3_utils  version  1.23  .  In  sg3_utils version 1.23 and later these
231       older options can be selected by either setting the  SG3_UTILS_OLD_OPTS
232       environment variable or using '--old' (or '-O) as the first option.
233
234       Options  with  arguments  or with two or more letters can have an extra
235       '-' prepended. For example: both '-pcb' and '--pcb' are acceptable.
236
237       -a     outputs all the log pages supported by the  device.   Equivalent
238              to --all in the main description.
239
240       -A     outputs  all the log pages and subpages supported by the device.
241              Equivalent to '--all --all' in the main description.
242
243       -c=PC  Equivalent to --control=PC in the main description.
244
245       -h     suppresses decoding of known log sense pages and prints out  the
246              response in hex instead.
247
248       -H     same  action  as '-h' in this section and equivalent to --hex in
249              the main description.
250
251       -l     lists the names of  all  logs  sense  pages  supported  by  this
252              device.  Equivalent to --list in the main description.
253
254       -L     lists  the  names of all logs sense pages and subpages supported
255              by this device.  Equivalent  to  '--list  --list'  in  the  main
256              description.
257
258       -m=LEN request  only  LEN bytes of response data. Default is 0 which is
259              interpreted as all that is available. LEN is decimal  unless  it
260              has  a leading '0x' or trailing 'h'.  Equivalent to --maxlen=LEN
261              in the main description.
262
263       -n     Equivalent to --name in the main description.
264
265       -N, --new
266              Switch to the newer style options. Enabeld by default.
267
268       -p=PG[,SPG]
269              PG is the log page code to access. Should be a hexadecimal  num‐
270              ber  between 0 and 3f inclusive. If given SPG is the log subpage
271              code.  SPG should be a  hexadecimal  number  between  0  and  ff
272              inclusive. The subpage code of 'ff' can be thought of as a wild‐
273              card.
274
275       -paramp=PP
276              PP is the parameter pointer value (in hex) to place in  command.
277              Should be a number between 0 and ffff inclusive.
278
279       -pcb   show  Parameter  Control  Byte  settings (only relevant when log
280              parameters being output in ASCII).
281
282       -ppc   sets the Parameter Pointer Control (PPC) bit. Default is 0 (i.e.
283              cleared).
284
285       -r     use  SCSI  LOG SELECT command (PCR bit set) to reset the all log
286              pages (or the given page). Equivalent to  --reset  in  the  main
287              description.
288
289       -select
290              use  a  LOG  SELECT  command. Equivalent to --select in the main
291              description.
292
293       -sp    sets  the  Saving  Parameters  (SP)  bit.  Default  is  0  (i.e.
294              cleared).  Equivalent to --sp in the main description.
295
296       -t     outputs the temperature. Equivalent to --temperature in the main
297              description.
298
299       -T     outputs the  transport  ('Protocol  specific  port')  log  page.
300              Equivalent to --transport in the main description.
301
302       -v     increase level of verbosity.
303
304       -V     print out version string then exit.
305
306       -?     output usage message then exit.
307

AUTHOR

309       Written by Douglas Gilbert
310

REPORTING BUGS

312       Report bugs to <dgilbert at interlog dot com>.
313
315       Copyright © 2002-2013 Douglas Gilbert
316       This  software is distributed under the GPL version 2. There is NO war‐
317       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
318       POSE.
319

SEE ALSO

321       smartctl(smartmontools), sg_senddiag(8)
322
323
324
325sg3_utils-1.37                     July 2013                        SG_LOGS(8)
Impressum