sendsyslog

Sends input data as syslog messages to a remote server over UDP.

Command properties

PropertyDescription
Command typeTransforming
Required permissionNone
License usageN/A
Parallel executionNot supported
Distributed executionNot supported

Syntax

sendsyslog dst=IP [port=INT] [format={txt|json}] [pri=INT] [src=IP]

Options

dst=IP

IP address of the syslog receiving server.

port=INT

Port number of the syslog receiving server. (Default: 514)

format={txt|json}

Syslog message body format. (Default: txt)

  • txt: Sends the value of the line field of the input record as-is.
  • json: Converts the entire input record to JSON format and sends it. The _id, _table, and _time fields are excluded.
pri=INT

PRI value as defined in RFC 5424. The default of 134 corresponds to the local0 facility and info severity. (Default: 134)

The PRI value equals the facility value multiplied by 8, plus the severity value.

Facility / Severity0/Emer1/Alert2/Crit3/Error4/Warn5/Notice6/Info7/Debug
0 / kern01234567
1 / user89101112131415
2 / mail1617181920212223
3 / daemon2425262728293031
4 / auth3233343536373839
5 / syslog4041424344454647
6 / lpr4849505152535455
7 / news5657585960616263
8 / uucp6465666768697071
9 / clock7273747576777879
10 / authpriv8081828384858687
11 / ftp8889909192939495
12 / ntp96979899100101102103
13 / audit104105106107108109110111
14 / alert112113114115116117118119
15 / solaris-cron120121122123124125126127
16 / local0128129130131132133134 (default)135
17 / local1136137138139140141142143
18 / local2144145146147148149150151
19 / local3152153154155156157158159
20 / local4160161162163164165166167
21 / local5168169170171172173174175
22 / local6176177178179180181182183
23 / local7184185186187188189190191
src=IP

Source IP address. When specified, sends the packet with this IP address as the source instead of the Logpresso server's IP address. Using this option causes packets to be generated directly through the PCAP device.

Input fields

FieldTypeRequiredDescription
linestringRequired when format=txtText to send as the syslog message body. If null, an empty string is sent.

Error codes

Parsing errors
Error codeMessageDescription
missing-dst-option(none)The dst option was not specified.
invalid-dst-ip(none)An invalid IP address was specified for the dst option.
invalid-format(none)A value other than txt or json was specified for the format option.
invalid-pri(none)A non-integer value was specified for the pri option.
invalid-port-number(none)A value outside the range 1–65535 was specified for the port option.
invalid-src-ip(none)An invalid IP address was specified for the src option.
Runtime errors
Error codeMessageDescription
pcap-device-failure(exception message)The PCAP device specified by the src option could not be opened

Description

The sendsyslog command generates a UDP syslog message for each input record and sends it to the specified remote server. Syslog messages are formatted as <PRI>body.

When format=txt, the value of the line field is used as the message body. When format=json, the entire input record is converted to JSON and used as the body, excluding the _id, _table, and _time fields. The message body uses <PRI>{...} format, with no RFC 3164/RFC 5424 timestamp or hostname headers. The encoding is UTF-8. For example, with PRI 134, the body looks like:

<134>{"src_ip":"192.168.0.10","src_port":52344,"dst_ip":"10.0.0.5","dst_port":443,"protocol":"tcp","bytes":1480}

Each field is converted to a JSON value according to the following rules.

Logpresso typeJSON representation
stringJSON string
integer, float (int, long, double, etc.)JSON number
booleantrue / false
nullnull
dateString in "yyyy-MM-dd HH:mm:ssZ" format (e.g., "2026-05-04 13:45:00+0900")
IP addressAddress string (e.g., "192.168.0.10")
UUIDUUID string
binaryLowercase hexadecimal string
arrayJSON array (each element recursively converted by the rules above)
mapJSON object (values recursively converted by the rules above)

The order of keys in the JSON object is not guaranteed. Write your receiver parser to operate based on key names. If the receiver needs time information, use the eval command to copy _time to a separate field before passing it to sendsyslog.

sendsyslog sends one UDP datagram per record. When format=json is used with large records, the serialized data may exceed the MTU, causing fragmentation or packet loss. Consider using sendsyslog-tcp for large records.

When the src option is specified, a UDP packet with an arbitrary source IP is generated using the PCAP device. Without the src option, a standard UDP socket is used. Using the src option requires libpcap (Linux/macOS) or WinPcap (Windows) to be installed on the operating system. Packets exceeding the MTU size may fail to be transmitted.

Regardless of whether transmission succeeds, the input record is passed to the next command unchanged. If a transmission error occurs, only the first error is logged; subsequent identical errors are suppressed.

Examples

  1. Send syslog messages in text format

    table duration=1h web_logs
    | sendsyslog dst=198.51.100.10
    

    Sends the line field of the web logs from the past hour as UDP syslog messages to 198.51.100.10:514.

  2. Send syslog messages in JSON format

    table duration=1h web_logs
    | sendsyslog dst=198.51.100.10 port=1514 format=json
    

    Converts all fields of the web logs to JSON format and sends them to 198.51.100.10:1514.

  3. Specify the PRI value and source IP

    table duration=1h web_logs
    | sendsyslog dst=198.51.100.10 pri=165 src=203.0.113.5
    

    Sets the PRI value to 165 (local4 + notice) and sends packets with 203.0.113.5 as the source IP.