<commit_before>---
title:  Configuring the gfsh Environment
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

The `gfsh.bat` and `gfsh` bash script automatically append the required Apache Geode and JDK .jar libraries to your existing CLASSPATH. There are user-configurable properties you can set for security, environment variables, logging, and troubleshooting.


## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_0D2EEA7A9ED54DFDB2E1EE955E47921E" class="no-quick-link"></a>JAR Libraries in CLASSPATH

When you start up `gfsh`, it will automatically load required JAR files that have been packaged in the `gfsh-dependencies.jar` file. You do not need to modify your CLASSPATH to run gfsh. When starting servers and locators in gfsh, the start server and start locator commands will load `server-dependencies.jar` and `locator-dependencies.jar` files into the process CLASSPATH for you.

These dependency JAR files are packaged in your Apache Geode installation in the `$GEMFIRE/lib` (or on Windows, the `%GEODE_HOME%\lib`) directory.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_02EEF9A519094EAD9D6B5C8E896EBA27" class="no-quick-link"></a>Machine Hostname

On some operating systems, you may need to ensure that the hostname of your machine is configured in your system hosts file. For example, on Mac OSX you may need to map your machine's hostname to your IP address in the `/etc/hosts` file in order for `gfsh` and Pulse to operate correctly.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_3FA4CD2B451B4A30A12D30DDE8DF8619" class="no-quick-link"></a>Configuring gfsh Security

Since `gfsh` must connect to a JMX Manager member to run certain commands (namely those commands that manage and monitor other members), JMX Manager configuration properties can affect `gfsh` security. In `gemfire.properties`, the following Geode properties can affect `gfsh` connection settings to the JMX Manager:

-   `jmx-manager-ssl`
-   `jmx-manager-port`
-   `jmx-manager-password-file`
-   `jmx-manager-access-file`

You may also need to verify that the ports are available and open to client connections. See [Configuring a JMX Manager](../../managing/management/jmx_manager_operations.html#topic_263072624B8D4CDBAD18B82E07AA44B6) for details on these security properties.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_C69A2711A7664A9091A5E634221053CB" class="no-quick-link"></a>Configuring gfsh Environment Variables

In addition, you can set several gfsh-specific preset SHELL variables by using the `set variable` command. For example, you can set `gfsh` to run in quiet mode. Not all `gfsh` variables are modifiable; user-configurable variables include:

-   APP\_FETCH\_SIZE
-   APP\_COLLECTION\_LIMIT
-   APP\_QUIET\_EXECUTION

See [Useful gfsh Shell Variables](useful_gfsh_shell_variables.html#concept_731ECA5E40E943CBA5C1198A0745D8EE) for more information.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_BE7FB8B355E748FA8BEFE75B2C3CB86E" class="no-quick-link"></a>Configuring gfsh Session Logging

By default, `gfsh` session logging is disabled. To enable gfsh logging, you must set the Java system property `-Dgfsh.log-level=desired_log_level` where *desired\_log \_level* is one of the following values: severe, warning, info, config, fine, finer, finest. For example, in Linux:

``` pre
export JAVA_ARGS=-Dgfsh.log-level=info
```

Then, start `gfsh`.

gfsh produces a log file named **gfsh-*%u*\_*%g*.log**. This log file records the events of an individual gfsh session. It includes environment information, such as Java and system information, and detailed command execution. The variables are replaced as follows:

-   **%u** - a unique number to resolve conflicts
-   **%g** - the generation number to distinguish rotated logs

gfsh uses the JDK Logger to generate gfsh session log files. See [http://docs.oracle.com/javase/7/docs/api/java/util/logging/FileHandler.html](http://docs.oracle.com/javase/7/docs/api/java/util/logging/FileHandler.html) for a description of how the variables are used in naming the log file. The default name of the generated gfsh log file cannot be changed.

By default, the log file is written to the current working directory where you have executed the `gfsh` or `gfsh.bat` script. To modify the directory location where log files are written, use the `gfsh.log-dir` Java system property. For example:

``` pre
export JAVA_ARGS="-Dgfsh.log-level=info -Dgfsh.log-dir=/machinename/logs"
```

Then, start `gfsh`.

In addition, `gfsh` records a history of commands in the `${SYS_USER_HOME}/.gemfire/.gfsh.history` file, which you can use to create scripts or review past commands.

## Member Log Files

gfsh writes several log files for any members that are started via gfsh. Useful member log files include:
<commit_msg>GEODE-3272 Doc update: .gfsh.history goes into .geode dir<commit_after>---
title:  Configuring the gfsh Environment
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

The `gfsh.bat` and `gfsh` bash script automatically append the required Apache Geode and JDK .jar libraries to your existing CLASSPATH. There are user-configurable properties you can set for security, environment variables, logging, and troubleshooting.


## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_0D2EEA7A9ED54DFDB2E1EE955E47921E" class="no-quick-link"></a>JAR Libraries in CLASSPATH

When you start up `gfsh`, it will automatically load required JAR files that have been packaged in the `gfsh-dependencies.jar` file. You do not need to modify your CLASSPATH to run gfsh. When starting servers and locators in gfsh, the start server and start locator commands will load `server-dependencies.jar` and `locator-dependencies.jar` files into the process CLASSPATH for you.

These dependency JAR files are packaged in your Apache Geode installation in the `$GEMFIRE/lib` (or on Windows, the `%GEODE_HOME%\lib`) directory.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_02EEF9A519094EAD9D6B5C8E896EBA27" class="no-quick-link"></a>Machine Hostname

On some operating systems, you may need to ensure that the hostname of your machine is configured in your system hosts file. For example, on Mac OSX you may need to map your machine's hostname to your IP address in the `/etc/hosts` file in order for `gfsh` and Pulse to operate correctly.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_3FA4CD2B451B4A30A12D30DDE8DF8619" class="no-quick-link"></a>Configuring gfsh Security

Since `gfsh` must connect to a JMX Manager member to run certain commands (namely those commands that manage and monitor other members), JMX Manager configuration properties can affect `gfsh` security. In `gemfire.properties`, the following Geode properties can affect `gfsh` connection settings to the JMX Manager:

-   `jmx-manager-ssl`
-   `jmx-manager-port`
-   `jmx-manager-password-file`
-   `jmx-manager-access-file`

You may also need to verify that the ports are available and open to client connections. See [Configuring a JMX Manager](../../managing/management/jmx_manager_operations.html#topic_263072624B8D4CDBAD18B82E07AA44B6) for details on these security properties.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_C69A2711A7664A9091A5E634221053CB" class="no-quick-link"></a>Configuring gfsh Environment Variables

In addition, you can set several gfsh-specific preset SHELL variables by using the `set variable` command. For example, you can set `gfsh` to run in quiet mode. Not all `gfsh` variables are modifiable; user-configurable variables include:

-   APP\_FETCH\_SIZE
-   APP\_COLLECTION\_LIMIT
-   APP\_QUIET\_EXECUTION

See [Useful gfsh Shell Variables](useful_gfsh_shell_variables.html#concept_731ECA5E40E943CBA5C1198A0745D8EE) for more information.

## <a id="concept_3B9C6CE2F64841E98C33D9F6441DF487__section_BE7FB8B355E748FA8BEFE75B2C3CB86E" class="no-quick-link"></a>Configuring gfsh Session Logging

By default, `gfsh` session logging is disabled. To enable gfsh logging, you must set the Java system property `-Dgfsh.log-level=desired_log_level` where *desired\_log \_level* is one of the following values: severe, warning, info, config, fine, finer, finest. For example, in Linux:

``` pre
export JAVA_ARGS=-Dgfsh.log-level=info
```

Then, start `gfsh`.

gfsh produces a log file named **gfsh-*%u*\_*%g*.log**. This log file records the events of an individual gfsh session. It includes environment information, such as Java and system information, and detailed command execution. The variables are replaced as follows:

-   **%u** - a unique number to resolve conflicts
-   **%g** - the generation number to distinguish rotated logs

gfsh uses the JDK Logger to generate gfsh session log files. See [http://docs.oracle.com/javase/7/docs/api/java/util/logging/FileHandler.html](http://docs.oracle.com/javase/7/docs/api/java/util/logging/FileHandler.html) for a description of how the variables are used in naming the log file. The default name of the generated gfsh log file cannot be changed.

By default, the log file is written to the current working directory where you have executed the `gfsh` or `gfsh.bat` script. To modify the directory location where log files are written, use the `gfsh.log-dir` Java system property. For example:

``` pre
export JAVA_ARGS="-Dgfsh.log-level=info -Dgfsh.log-dir=/machinename/logs"
```

Then, start `gfsh`.

In addition, `gfsh` records a history of commands in the `${SYS_USER_HOME}/.geode/.gfsh.history` file, which you can use to create scripts or review past commands.

## Member Log Files

gfsh writes several log files for any members that are started via gfsh. Useful member log files include:

{'fraction_non_alphanumeric': 0.07626661875673733, 'fraction_numerical': 0.04365792310456342, 'mean_word_length': 5.063725490196078, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4890075', 'n_tokens_mistral': 3677, 'n_tokens_neox': 3329, 'n_words': 1325}