---
title: "Syslog (_Syslog class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/512983166/Syslog%20(_Syslog%20class)"
format: markdown
---
> Macro (toc)

---

_Syslog class is used for sending log messages to the Syslog server. The variable of the type _Syslog class is built-in and cannot be declared in the program. More information about Syslog protocol which is a standard protocol for message logging is available on [https://en.wikipedia.org/wiki/Syslog](https://en.wikipedia.org/wiki/Syslog)  

# Enum _SyslogProtocol

```visualbasic
Enum _SyslogProtocol  
  _SyslogProtocol_UDP := 1,  
  _SyslogProtocol_TCP := 2  
End Enum
```

# Enum _SyslogFormat

```visualbasic
Enum _SyslogFormat  
  _SyslogFormat_BSD_RFC3164 := 1, 
  _SyslogFormat_IETF_RFC5424 := 2, 
  _SyslogFormat_IETF_RFC5424_NONTRANSPARENTFRAMING := 3 
End Enum
```

# GetServer

This function returns the actual setting which is used for sending log messages to the Syslog server. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function GetServer(ByRef serveraddress As Text, 
  ByRef port As Long,
  ByRef syslogprotocol As Long, 
  ByRef syslogformat As Long) 
As Boolean
```

#### Parameters 

serveraddress 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the IP address or domain name of the Syslog server. 

port 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the destination port on the Syslog server which is used to send log messages. 

syslogprotocol 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the type of Syslog transfer protocol that is used for sending log messages to the Syslog server. The returned value is from the enum _SyslogProtocol. 

syslogformat 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the format of Syslog format which is used for sending log messages to the Syslog server. The returned value is from the enum _SyslogFormat. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>. 

# SetServer

This function sets Syslog server parameters and must be called before sending any message to the Syslog server. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SetServer(
  serveraddress As Text, 
  port As Long,  
  syslogprotocol As Long, 
  syslogformat As Long) 
As Boolean
```

#### Parameters 

serveraddress 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the IP address or domain name of the Syslog server. 

port 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the destination port on the Syslog server which is used to send log messages. 

syslogprotocol 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the type of Syslog transfer protocol that is used for sending log messages to the Syslog server. The transferprotocol argument can have values from the enum _SyslogProtocol. 

syslogformat 

<u>[Long](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> It is the format of Syslog format which is used for sending log messages to the Syslog server. The logformat argument can have values from the enum _SyslogFormat. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[319](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#319)</u>, <u>[320](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#320)</u>. 

# SendCriticalMessage

This function sends formatted text to the Syslog server as a message with critical severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SendCriticalMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

# SendErrorMessage

This function sends formatted text to the Syslog server as a message with error severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs.  

#### Syntax 

```visualbasic
Function SendErrorMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

# SendWarningMessage

This function sends formatted text to the Syslog server as a message with warning severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SendWarningMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

# SendNoticeMessage

This function sends formatted text to the Syslog server as a message with notice severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SendNoticeMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

# SendInfoMessage

This function sends formatted text to the Syslog server as a message with info severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SendInfoMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

# SendDebugMessage

This function sends formatted text to the Syslog server as a message with debug severity. The message facility is set to local0 (16). Printed statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. The command returns True on success or False if an error occurs. 

#### Syntax 

```visualbasic
Function SendDebugMessage(formattext As Text, ParamArray) As Boolean
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the text for sending to the Syslog server. Only ASCII characters can be included now. Other characters will be removed from the messages before sending. 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed statements. 

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. 

The function GetLastError returns the error number. The errors that can happen: <u>[88](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#88)</u>, <u>[321](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#321)</u>, <u>[322](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#322)</u>. 

#### Example 

```visualbasic
Syslog.SetServer("192.168.1.5", 514, _SyslogProtocol_UDP, _SyslogFormat_BSD_RFC3164) 

Syslog.SendInfo("Hello world") 

Syslog.SendInfo("Message with numbers: {n}, {n}.", 5, 6)
```

# Synology NAS - Log Center

Example settings when using Synology NAS as a Syslog server. [https://www.synology.com/en-us/knowledgebase/DSM/help/DSM/LogCenter/logcenter_desc](https://www.synology.com/en-us/knowledgebase/DSM/help/DSM/LogCenter/logcenter_desc)  

#### UDP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<synology IP address>, 514, _SyslogProtocol_UDP, _SyslogFormat_BSD_RFC3164)
```

![image](media://705f41a8-432f-4523-8e66-6d76ea1f758d)

####  TCP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<synology IP address>, 514, _SyslogProtocol_TCP, _SyslogFormat_BSD_RFC3164)
```

![image](media://d6578e42-3e0a-448e-9745-77969dd86df5)

#### UDP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<synology IP address>, 514, _SyslogProtocol_UDP, _SyslogFormat_IETF_RFC5424)
```

![image](media://fec9df8c-f37e-4465-b09a-73286cd8b5c8)

#### TCP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<synology IP address>, 514, _SyslogProtocol_TCP, _SyslogFormat_IETF_RFC5424)
```

![image](media://827008af-fc8d-474b-bcf6-6fa1009c122b)

# Syslog Watcher

Example settings when using the application Syslog Watcher [https://www.snmpsoft.com/syslog-watcher](https://www.snmpsoft.com/syslog-watcher)  

#### UDP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_UDP, _SyslogFormat_BSD_RFC3164)
```

#### TCP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_TCP, _SyslogFormat_BSD_RFC3164)
```

#### UDP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_UDP, _SyslogFormat_IETF_RFC5424)
```

#### TCP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_TCP, _SyslogFormat_IETF_RFC5424_NONTRANSPARENTFRAMING)
```

![image](media://691a1df9-ce6c-4b75-b98c-5ec5efe87888)

# Kiwi Syslog Server

Example settings when using the application Kiwi Syslog Server [http://www.solarwinds.com/kiwi-syslog-server](http://www.solarwinds.com/kiwi-syslog-server)   

#### UDP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_UDP, _SyslogFormat_BSD_RFC3164)
```

#### UDP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_UDP, _SyslogFormat_IETF_RFC5424)
```

![image](media://157c4431-dfb9-4bc1-8080-17374caebf57)

#### TCP protocol, BSD Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_TCP, _SyslogFormat_BSD_RFC3164)
```

#### TCP protocol, IETF Format 

```visualbasic
Syslog.SetServer(<IP address of PC with Syslog Watcher>, 514, _SyslogProtocol_TCP, _SyslogFormat_IETF_RFC5424_NONTRANSPARENTFRAMING)
```

![image](media://15f23173-c875-494f-9aa3-7650e32a0111)