type=page
status=published
title=collect-log-files
next=configure-jms-cluster.html
prev=change-master-password.html
~~~~~~

= collect-log-files

[[collect-log-files-1]][[GSRFM00007]][[collect-log-files]]

== collect-log-files

Creates a ZIP archive of all available log files

[[sthref69]]

=== Synopsis

[source]
----
asadmin [asadmin-options] collect-log-files [--help]
[--target target]
[--retrieve={false|true}] [retrievefilepath]]
----

[[sthref70]]

=== Description

The `collect-log-files` subcommand collects all available log files for
the domain administration server (DAS), the specified cluster, or the
specified {productName} instance and creates a single ZIP archive of
the log files. If a cluster is specified, the ZIP archive also contains
the log file for the DAS.

This subcommand is supported in remote mode only.

[[sthref71]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--retrieve`::
  Specifies whether the ZIP archive is created in a directory other than
  the default directory. +
  By default the ZIP archive is created in the
  domain-dir`/collected-logs` directory. The ZIP file names are
  constructed from the specified target and timestamp, as follows:
+
[source]
----
log_yyyy-mm-dd_hh-min-sec.zip
----
+
Possible values are as follows:
+
  `false`;;
    The ZIP archive will be created in the default directory. If
    omitted, the `--retrieve` option defaults to `false`.
  `true`;;
    The ZIP archive will be created in the directory that the
    retrievefilepath operand specifies. If retrievefilepath is omitted,
    the ZIP archive will be created in the default directory.
`--target`::
  Specifies the target for which log files will be collected. +
  Possible values are as follows:

  `server`;;
    The log files will be collected for the DAS (default).
  instance-name;;
    The log files will be collected for the specified {productName} instance.
  cluster-name;;
    The log files will be collected for the specified cluster and the DAS.

[[sthref72]]

=== Operands

retrievefilepath::
  The name of the directory in which the ZIP archive will be created. If
  this operand is omitted, the ZIP archive will be created in the
  default directory. If the `--retrieve` option is `false`, this operand
  is ignored.

[[sthref73]]

=== Examples

[[GSRFM451]][[sthref74]]

==== Example 1   Collecting Log Files for the Default Server

This example generates a ZIP archive from the log files for the default
server.

[source]
----
asadmin> collect-log-files
Created Zip file under /space/gf/glassfish7/glassfish/domains/domain1/\
collected-logs/log_2021-12-15_15-46-23.zip.
Command collect-log-files executed successfully.
----

[[GSRFM452]][[sthref75]]

==== Example 2   Collecting Log Files for a Cluster

This example generates a ZIP archive from the log files for a cluster
named `cluster1` and the two server instances running in the cluster.

[source]
----
asadmin> collect-log-files --target cluster1
Log files are downloaded for instance1.
Log files are downloaded for instance2.
Created Zip file under /space/gfv/glassfish7/glassfish/domains/domain1/\
collected-logs/log_2021-12-15_15-54-06.zip.
Command collect-log-files executed successfully.
----

[[GSRFM453]][[sthref76]]

==== Example 3   Collecting Log Files in a Directory Other Than the Default
for a Cluster

This example generates a ZIP archive from the log files for a cluster
named `cluster1` and its two server instances, and saves the archive in
a directory named `/space/output`.

[source]
----
asadmin> collect-log-files --target cluster1 --retrieve true /space/output
Log files are downloaded for instance1.
Log files are downloaded for instance2.
Created Zip file under /space/output/log_2010-12-15_15-55-54.zip.
Command collect-log-files executed successfully.
----

[[sthref77]]

=== Exit Status

0::
  subcommand executed successfully
1::
  error in executing the subcommand

[[sthref78]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:list-log-attributes.html#list-log-attributes-1[`list-log-attributes`(1)],
link:list-log-levels.html#list-log-levels-1[`list-log-levels`(1)],
link:rotate-log.html#rotate-log-1[`rotate-log`(1)],
link:set-log-attributes.html#set-log-attributes-1[`set-log-attributes`(1)],
link:set-log-levels.html#set-log-levels-1[`set-log-levels`(1)]

"link:administration-guide/logging.html#GSADG00010[Administering the Logging Service]" in {productName} Administration Guide


