---
title: "How to change logging level in NSX"
date: "2016-09-30T07:00:27Z"
tags: ["Logging", "NSX", "SDN", "Syslog"]
categories: ["Networking & Security", "VMware"]
---

![How to change logging level in NSX - Logo][1]

Troubleshooting issues aren't always fun and easy way to do. Especially in complex environments where multiple issues might occur at the same time. Having a way to easily find root cause is crucial. Today I will show you how to change logging level in NSX and its components.
<!--more-->
<!--adsense-->
# Change logging level in NSX Manager

Unfortunately, it isn't possible to change logging level in NSX Manager fro GUI. It has to be done using API calls or from the command line. In my earlier post https://www.wojcieh.net/configuring-syslog-server-for-vmware-nsx-components/ , I showed you how certain operations are done using REST API calls.

NSX Manager log levels:

|||||||||
|--- |--- |--- |--- |--- |--- |--- |--- |
|OFF|FATAL|WARN|ERROR|INFO|DEBUG|TRACE|ALL|

## Change logging level in NSX Manager - API

To check what kind of logging level initiate the following API call

```
GET https://IP ADDR/api/1.0/services/debug/loglevel/com.vmware.vshield
```
![How to change logging level in NSX - 1][2]

To enable debug logging level in NSX Manager initiate the following API call

```
POST https://IP ADDR/api/1.0/services/debug/loglevel/com.vmware.vshield?level=DEBUG
```
![How to change logging level in NSX - 2][3]

We will check once again if logging was changed to debug.

![How to change logging level in NSX - 3][4]

## Change logging level in NSX Manager - command line

Changing logging level in NSX Manager via command line is fairly easy.

Login to NSX Manager via SSH and firs let's check what is current logging level.

```
show com.vmware.vshield logging-level
```
![How to change logging level in NSX - 4][5]

Next step is to change it to another level.

![How to change logging level in NSX - 5][6]

# Changing log level of NSX control plane

NSX Control Plane logs are written on each ESXi host. To modify ESXi **netcpa** log level it has to be done from command line.

Login to ESXi hosts you want to troubleshoot and find **netcpa.xml** file.

![How to change logging level in NSX - 6][7]

Enable writing to file by typing:

```
chmod +wt /usr/lib/vmware/netcpa/etc/netcpa.xml
```

Edit the file in vi and change following line:

```
<level>info</level>
```

to desired log level

```
<level>debug</level>
```

Restart netcpa service by typing:

**/etc/init.d/netcpad restart**

# Changing logging level on Distributed Logical Router or Edge Services Gateway

There are several ways to change logging level on Distributed Logical Router or Edge Services Gateway.

## Changing logging level on Distributed Logical Router or Edge Services Gateway - API call

In REST Client initiate following call

```
POST https://NSX Manager IP/api/4.0/edges/edgeID/logging?level=debug
```

![How to change logging level in NSX - 7][8]

Let's check what level is configured in GUI.

![How to change logging level in NSX - 8][9]

## Changing logging level on Distributed Logical Router or Edge Services Gateway - GUI

To change logging level on Distributed Logical Router or Edge Services Gateway click **Action** on DLR or ESG.

![How to change logging level in NSX - 9][10]

Select desired logging level.

![How to change logging level in NSX - 10][11]

There is as well possibility to enable logging with a different level per DLR or ESG components.

### DLR Components

1. DLR - HA 
![How to change logging level in NSX - 11][12]
2. DLR - Dynamic Routing
![How to change logging level in NSX - 12][13]

### ESG Components

1. ESG - DHCP<br>
![How to change logging level in NSX - 13][14]
2. ESG - NAT rules<br>
![How to change logging level in NSX - 14][15]
3. ESG - Routing<br>
![How to change logging level in NSX - 15][16]
4. ESG - Load Balancer
![How to change logging level in NSX - 16][17]
5. ESG - IPsec VPN<br>
![How to change logging level in NSX - 17][18]
6. ESG - SSL VPN-Plus
![How to change logging level in NSX - 18][19]

## Enabling Firewall logging

Enabling firewall rule logging is very easy.

Click on rule you want to log and in **action** section choose **Log**.<br>
![How to change logging level in NSX - 19][20]

# Summary

I hope you enjoyed this article. If you have any questions simply write a comment.

<a href="ttps://pubs.vmware.com/NSX-62/topic/com.vmware.ICbase/PDF/nsx_62_api.pdf" target="_blank" rel="noopener noreferrer">NSX 6.2 API Reference Guide</a>

[1]: /images/uploads/2016/08/how-to-change-logging-level-in-nsx.webp
[2]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-1.webp
[3]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-2.webp
 [4]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-3.webp
 [5]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-4.webp
 [6]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-5.webp
 [7]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-6.webp
 [8]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-7.webp
 [9]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-8.webp
 [10]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-9.webp
 [11]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-10.webp
 [12]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-18.webp
 [13]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-19.webp
 [14]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-12.webp
 [15]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-13.webp
 [16]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-14.webp
 [17]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-15.webp
 [18]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-16.webp
 [19]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-17.webp
 [20]: /images/uploads/2016/09/how-to-change-logging-level-in-nsx-11.webp
