2 * Routines for syslog message dissection
4 * Copyright 2000, Gerald Combs <gerald[AT]wireshark.org>
6 * Support for passing SS7 MSUs (from the Cisco ITP Packet Logging
7 * facility) to the MTP3 dissector by Abhik Sarkar <sarkar.abhik[AT]gmail.com>
8 * with some rework by Jeff Morriss <jeff.morriss.ws [AT] gmail.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald[AT]wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
19 #include <epan/packet.h>
20 #include <epan/expert.h>
21 #include <epan/strutil.h>
23 #include "packet-syslog.h"
24 #include "packet-acdr.h"
25 #include "packet-tcp.h"
27 #define SYSLOG_PORT_UDP 514
28 #define SYSLOG_PORT_TLS 6514
30 #define PRIORITY_MASK 0x0007 /* 0000 0111 */
31 #define FACILITY_MASK 0x03F8 /* 1111 1000 */
33 #define MSG_BOM 0xEFBBBF
34 #define RFC5424_V 0x3120 /* '1 ' */
35 #define NIL_VALUE 0x2D /* '-' */
36 #define SD_START 0x5B /* '[' */
37 #define SD_END 0x5D /* ']' */
38 #define SD_STOP 0x5D20 /* '] ' */
39 #define SD_DELIM 0x5D5B /* '][' */
40 #define CHR_SPACE 0x20 /* ' ' */
41 #define CHR_COLON 0x3A /* ':' */
42 #define CHR_EQUAL 0x3D /* '=' */
43 #define CHR_QUOTE 0x22 /* '"' */
44 #define CHR_0 0x30 /* '0' */
46 void proto_reg_handoff_syslog(void);
47 void proto_register_syslog(void);
49 /* The maximum number if priority digits to read in. */
52 /* The maximum chars for framing to read in */
53 #define MAX_FRAMING_DIGITS 5
55 static const value_string short_level_vals
[] = {
56 { LEVEL_EMERG
, "EMERG" },
57 { LEVEL_ALERT
, "ALERT" },
58 { LEVEL_CRIT
, "CRIT" },
60 { LEVEL_WARNING
, "WARNING" },
61 { LEVEL_NOTICE
, "NOTICE" },
62 { LEVEL_INFO
, "INFO" },
63 { LEVEL_DEBUG
, "DEBUG" },
67 static const value_string short_facility_vals
[] = {
71 { FAC_DAEMON
, "DAEMON" },
73 { FAC_SYSLOG
, "SYSLOG" },
77 { FAC_CRON
, "CRON" }, /* The BSDs, Linux, and others */
78 { FAC_AUTHPRIV
, "AUTHPRIV" },
81 { FAC_LOGAUDIT
, "LOGAUDIT" },
82 { FAC_LOGALERT
, "LOGALERT" },
83 { FAC_CRON_SOL
, "CRON" }, /* Solaris */
84 { FAC_LOCAL0
, "LOCAL0" },
85 { FAC_LOCAL1
, "LOCAL1" },
86 { FAC_LOCAL2
, "LOCAL2" },
87 { FAC_LOCAL3
, "LOCAL3" },
88 { FAC_LOCAL4
, "LOCAL4" },
89 { FAC_LOCAL5
, "LOCAL5" },
90 { FAC_LOCAL6
, "LOCAL6" },
91 { FAC_LOCAL7
, "LOCAL7" },
95 static int proto_syslog
;
96 static int hf_syslog_msglen
;
97 static int hf_syslog_level
;
98 static int hf_syslog_facility
;
99 static int hf_syslog_msu_present
;
100 static int hf_syslog_version
;
101 static int hf_syslog_timestamp
;
102 static int hf_syslog_timestamp_old
;
103 static int hf_syslog_hostname
;
104 static int hf_syslog_appname
;
105 static int hf_syslog_procid
;
106 static int hf_syslog_msg
;
107 static int hf_syslog_msgid
;
108 static int hf_syslog_bom
;
109 static int hf_syslog_sd
;
110 static int hf_syslog_sd_element
;
111 static int hf_syslog_sd_element_name
;
112 static int hf_syslog_sd_param
;
113 static int hf_syslog_sd_param_name
;
114 static int hf_syslog_sd_param_value
;
116 static int ett_syslog
;
117 static int ett_syslog_sd
;
118 static int ett_syslog_sd_element
;
119 static int ett_syslog_sd_param
;
121 static expert_field ei_syslog_msg_nonconformant
;
123 static dissector_handle_t syslog_handle
;
124 static dissector_handle_t syslog_handle_tcp
;
126 static dissector_handle_t mtp_handle
;
128 /* The Cisco ITP's packet logging facility allows selected (SS7) MSUs to be
129 * to be encapsulated in syslog UDP datagrams and sent to a monitoring tool.
130 * However, no actual tool to monitor/decode the MSUs is provided. The aim
131 * of this routine is to extract the hex dump of the MSU from the syslog
132 * packet so that it can be passed on to the mtp3 dissector for decoding.
135 mtp3_msu_present(tvbuff_t
*tvb
, packet_info
*pinfo
, int fac
, int level
, const char *msg_str
, int chars_truncated
)
139 char **split_string
, *msu_hex_dump
;
140 tvbuff_t
*mtp3_tvb
= NULL
;
143 /* In the sample capture I have, all MSUs are LOCAL0.DEBUG.
144 * Try to optimize this routine for most syslog users by short-cutting
147 if (!(fac
== FAC_LOCAL0
&& level
== LEVEL_DEBUG
))
150 if (strstr(msg_str
, "msu=") == NULL
)
153 split_string
= g_strsplit(msg_str
, "msu=", 2);
154 msu_hex_dump
= split_string
[1];
156 if (msu_hex_dump
&& (len
= strlen(msu_hex_dump
))) {
158 /* convert_string_to_hex() will return NULL if it gets an incomplete
159 * byte. If we have an odd string length then chop off the remaining
160 * nibble so we can get at least a partial MSU (chances are the
161 * subdissector will except out, of course).
164 msu_hex_dump
[len
- 1] = '\0';
166 byte_array
= convert_string_to_hex(msu_hex_dump
, &nbytes
);
169 mtp3_tvb
= tvb_new_child_real_data(tvb
, byte_array
, (unsigned)nbytes
,
170 (unsigned)nbytes
+ chars_truncated
/ 2);
171 tvb_set_free_cb(mtp3_tvb
, g_free
);
172 /* ...and add the encapsulated MSU as a new data source so that it gets
173 * its own tab in the packet bytes pane.
175 add_new_data_source(pinfo
, mtp3_tvb
, "Encapsulated MSU");
179 g_strfreev(split_string
);
184 static bool dissect_syslog_info(proto_tree
* tree
, tvbuff_t
* tvb
, unsigned* offset
, int hfindex
)
186 int end_offset
= tvb_find_uint8(tvb
, *offset
, -1, CHR_SPACE
);
187 if (end_offset
== -1)
189 proto_tree_add_item(tree
, hfindex
, tvb
, *offset
, end_offset
- *offset
, ENC_NA
);
190 *offset
= end_offset
+ 1;
194 static bool dissect_syslog_sd(proto_tree
* tree
, tvbuff_t
* tvb
, packet_info
*pinfo
, unsigned* offset
)
199 unsigned counter_parameters
, counter_elements
= 0;
201 // Check for NIL value
202 if(tvb_reported_length_remaining(tvb
, *offset
) >= 2) {
203 if(tvb_get_uint8(tvb
, *offset
) == NIL_VALUE
&& tvb_get_uint8(tvb
, *offset
+ 1) == CHR_SPACE
) {
204 ti
= proto_tree_add_item(tree
, hf_syslog_sd
, tvb
, *offset
, 1, ENC_NA
);
205 proto_item_append_text(ti
, ": -");
206 *offset
= *offset
+ 2;
211 /* Validate the start */
212 if(tvb_get_uint8(tvb
, *offset
) != SD_START
)
216 int sd_end
= tvb_find_uint16(tvb
, *offset
, -1, SD_STOP
);
220 ti
= proto_tree_add_item(tree
, hf_syslog_sd
, tvb
, *offset
, sd_end
- *offset
+ 1, ENC_NA
);
221 sd_tree
= proto_item_add_subtree(ti
, ett_syslog_sd
);
224 while(*offset
< (unsigned)sd_end
) {
226 proto_item
*ti_element
;
227 proto_tree
*element_tree
;
229 /* Find the end of current element (finding is guaranteed, because we already checked for SD_STOP) */
230 int element_end
= tvb_find_uint8(tvb
, *offset
, -1, SD_END
);
231 ti_element
= proto_tree_add_item(sd_tree
, hf_syslog_sd_element
, tvb
, *offset
, element_end
- *offset
+ 1, ENC_NA
);
232 element_tree
= proto_item_add_subtree(ti_element
, ett_syslog_sd_element
);
234 /* First char is opening bracket, move offset */
235 *offset
= *offset
+ 1;
238 while(*offset
< (unsigned)element_end
) {
240 /* Find the first space char (=SD-NAME), move to next element if failed */
241 int sdname_end
= tvb_find_uint8(tvb
, *offset
, -1, CHR_SPACE
);
242 if(sdname_end
== -1 || sdname_end
>= element_end
) {
243 *offset
= element_end
+ 1;
247 proto_tree_add_item(element_tree
, hf_syslog_sd_element_name
, tvb
, *offset
, sdname_end
- *offset
, ENC_ASCII
);
248 proto_item_append_text(ti_element
, " (%s)", tvb_get_string_enc(pinfo
->pool
, tvb
, *offset
, sdname_end
- *offset
, ENC_ASCII
));
249 *offset
= sdname_end
+ 1;
252 counter_parameters
= 0;
253 while(*offset
< (unsigned)element_end
) {
255 proto_item
*ti_param
;
256 proto_tree
*param_tree
;
258 /* Find the first equals char ('=') which delimits param name and value, move to next element if failed */
259 int param_value_divide
= tvb_find_uint8(tvb
, *offset
, -1, CHR_EQUAL
);
260 if(param_value_divide
== -1 || param_value_divide
>= element_end
) {
261 *offset
= element_end
+ 1;
267 ti_param
= proto_tree_add_item(element_tree
, hf_syslog_sd_param
, tvb
, *offset
, 0, ENC_NA
);
268 param_tree
= proto_item_add_subtree(ti_param
, ett_syslog_sd_param
);
270 /* Get parameter name */
271 proto_tree_add_item(param_tree
, hf_syslog_sd_param_name
, tvb
, *offset
, param_value_divide
- *offset
, ENC_ASCII
);
272 proto_item_append_text(ti_param
, " (%s)", tvb_get_string_enc(pinfo
->pool
, tvb
, *offset
, param_value_divide
- *offset
, ENC_ASCII
));
273 *offset
= param_value_divide
+ 1;
275 /* Find the first and second quote char which marks the start and end of a value */
276 int value_start
= tvb_find_uint8(tvb
, *offset
, -1, CHR_QUOTE
);
277 int value_end
= tvb_find_uint8(tvb
, *offset
+1, -1, CHR_QUOTE
);
279 /* If start or end could not be determined, move to next element */
280 if(value_start
== -1 || value_end
== -1 || value_start
>= element_end
|| value_end
>= element_end
) {
281 *offset
= element_end
+ 1;
286 proto_tree_add_item(param_tree
, hf_syslog_sd_param_value
, tvb
, value_start
+1, value_end
-value_start
-1, ENC_ASCII
);
287 proto_item_set_end(ti_param
, tvb
, value_end
+1);
288 *offset
= value_end
+ 2;
290 counter_parameters
++;
293 proto_item_append_text(ti_element
, " (%d parameter%s)", counter_parameters
, plurality(counter_parameters
, "", "s"));
298 proto_item_append_text(ti
, " (%d element%s)", counter_elements
, plurality(counter_elements
, "", "s"));
300 /* Move offset by one byte because space char is expected */
301 *offset
= *offset
+ 1;
306 /* Dissect message as defined in RFC5424 */
308 dissect_rfc5424_syslog_message(proto_tree
* tree
, tvbuff_t
* tvb
, packet_info
*pinfo
, unsigned offset
)
312 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_version
))
315 end_offset
= tvb_find_uint8(tvb
, offset
, -1, CHR_SPACE
);
316 if (end_offset
== -1)
318 if ((unsigned)end_offset
!= offset
) {
319 /* do not call proto_tree_add_time_item with a length of 0 */
320 proto_tree_add_time_item(tree
, hf_syslog_timestamp
, tvb
, offset
, end_offset
- offset
, ENC_ISO_8601_DATE_TIME
,
323 offset
= end_offset
+ 1;
325 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_hostname
))
327 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_appname
))
329 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_procid
))
331 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_msgid
))
334 /* STRUCTURED DATA */
335 if (!dissect_syslog_sd(tree
, tvb
, pinfo
, &offset
))
338 /* Check for BOM and read in the rest of msg*/
339 if (tvb_reported_length_remaining(tvb
, offset
) > 3 && tvb_get_uint24(tvb
, offset
, ENC_BIG_ENDIAN
) == MSG_BOM
) {
340 proto_tree_add_item(tree
, hf_syslog_bom
, tvb
, offset
, 3, ENC_BIG_ENDIAN
);
343 proto_tree_add_item(tree
, hf_syslog_msg
, tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
), ENC_UTF_8
);
345 proto_tree_add_item(tree
, hf_syslog_msg
, tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
), ENC_ASCII
);
347 return tvb_reported_length(tvb
);
350 /* Dissect message as defined in RFC3164 */
352 dissect_rfc3164_syslog_message(proto_tree
* tree
, tvbuff_t
* tvb
, unsigned offset
)
354 unsigned tvb_offset
= 0;
356 /* RFC 3164 HEADER section */
358 /* Simple check if the first 16 bytes look like TIMESTAMP "Mmm dd hh:mm:ss"
359 * by checking for spaces and colons. Otherwise return without processing
361 if (tvb_get_uint8(tvb
, offset
+ 3) == CHR_SPACE
&& tvb_get_uint8(tvb
, offset
+ 6) == CHR_SPACE
&&
362 tvb_get_uint8(tvb
, offset
+ 9) == CHR_COLON
&& tvb_get_uint8(tvb
, offset
+ 12) == CHR_COLON
&&
363 tvb_get_uint8(tvb
, offset
+ 15) == CHR_SPACE
) {
364 proto_tree_add_item(tree
, hf_syslog_timestamp_old
, tvb
, offset
, 15, ENC_ASCII
);
370 if (!dissect_syslog_info(tree
, tvb
, &offset
, hf_syslog_hostname
))
373 /* RFC 3164 MSG section */
375 /* TAG field (proc) */
376 for (tvb_offset
=offset
; tvb_offset
< offset
+32; tvb_offset
++){
378 octet
= tvb_get_uint8(tvb
, tvb_offset
);
379 if (!g_ascii_isalnum(octet
)){
380 proto_tree_add_item(tree
, hf_syslog_procid
, tvb
, offset
, tvb_offset
- offset
, ENC_ASCII
);
381 offset
= tvb_offset
+1;
387 /* Read in the rest as msg */
388 proto_tree_add_item(tree
, hf_syslog_msg
, tvb
, offset
, tvb_reported_length_remaining(tvb
, offset
), ENC_ASCII
);
389 return tvb_reported_length(tvb
);
392 /* Checks if Octet Counting Framing is used and return entire PDU length */
394 get_framed_syslog_pdu_len(packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
397 RFC 6587: Octet Counting Framing can be assumed if the data starts with non-zero digits.
398 SYSLOG-FRAME = MSG-LEN SP SYSLOG-MSG
400 This function returns the length of the PDU (incl. leading <LEN><SPACE>)
403 /* Find leading integers */
404 int digits_str_len
= 0;
405 while(tvb_bytes_exist(tvb
, offset
+ digits_str_len
, 1) && digits_str_len
< MAX_FRAMING_DIGITS
) {
406 uint8_t current_char
= tvb_get_uint8(tvb
, offset
+ digits_str_len
);
407 if(!g_ascii_isdigit(current_char
) || (digits_str_len
== 0 && current_char
== CHR_0
))
412 /* Get the actual integer from string */
413 unsigned msg_len
= 0;
414 unsigned multiplier
= 1;
415 if(digits_str_len
> 0) {
416 const uint8_t *digits_str
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, digits_str_len
, ENC_ASCII
);
417 for (unsigned d
= digits_str_len
; d
> 0; d
--) {
418 msg_len
+= ((digits_str
[d
-1] - CHR_0
) * multiplier
);
424 When a <space> is found after the length digits, it seems to be framed TCP
426 if(msg_len
> 0 && tvb_bytes_exist(tvb
, offset
, digits_str_len
+1)) {
427 if(tvb_get_uint8(tvb
, offset
+ digits_str_len
) == CHR_SPACE
) {
428 return msg_len
+ 1 + digits_str_len
;
436 /* Main dissection function */
438 dissect_syslog(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
440 int pri
= -1, lev
= -1, fac
= -1;
441 int msg_off
= 0, pri_digits
= 0, pri_chars
= 0, msg_len
, reported_msg_len
, framing_leading_str_len
= 0;
442 unsigned framing_pdu_len
;
444 proto_tree
*syslog_tree
;
448 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Syslog");
449 col_clear(pinfo
->cinfo
, COL_INFO
);
451 framing_pdu_len
= get_framed_syslog_pdu_len(pinfo
, tvb
, msg_off
, data
);
452 if(framing_pdu_len
> 0) {
453 framing_leading_str_len
= snprintf(NULL
, 0, "%d", framing_pdu_len
) + 1;
454 msg_off
+= framing_leading_str_len
;
457 if (tvb_get_uint8(tvb
, msg_off
) == '<') {
458 /* A facility and level follow. */
462 while (tvb_bytes_exist(tvb
, msg_off
, 1) &&
463 g_ascii_isdigit(tvb_get_uint8(tvb
, msg_off
)) && pri_digits
<= MAX_DIGITS
) {
464 pri
= pri
* 10 + (tvb_get_uint8(tvb
, msg_off
) - CHR_0
);
469 if (tvb_get_uint8(tvb
, msg_off
) == '>') {
473 fac
= (pri
& FACILITY_MASK
) >> 3;
474 lev
= pri
& PRIORITY_MASK
;
477 msg_len
= tvb_ensure_captured_length_remaining(tvb
, msg_off
);
478 msg_str
= tvb_format_text(pinfo
->pool
, tvb
, msg_off
, msg_len
);
479 reported_msg_len
= tvb_reported_length_remaining(tvb
, msg_off
);
481 mtp3_tvb
= mtp3_msu_present(tvb
, pinfo
, fac
, lev
, msg_str
,
482 (reported_msg_len
- msg_len
));
484 if (mtp3_tvb
== NULL
) {
486 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "%s.%s: %s",
487 val_to_str_const(fac
, short_facility_vals
, "UNKNOWN"),
488 val_to_str_const(lev
, short_level_vals
, "UNKNOWN"), msg_str
);
490 col_add_str(pinfo
->cinfo
, COL_INFO
, msg_str
);
495 ti
= proto_tree_add_protocol_format(tree
, proto_syslog
, tvb
, 0, -1,
496 "Syslog message: %s.%s: %s",
497 val_to_str_const(fac
, short_facility_vals
, "UNKNOWN"),
498 val_to_str_const(lev
, short_level_vals
, "UNKNOWN"), msg_str
);
500 ti
= proto_tree_add_protocol_format(tree
, proto_syslog
, tvb
, 0, -1,
501 "Syslog message: (unknown): %s", msg_str
);
503 syslog_tree
= proto_item_add_subtree(ti
, ett_syslog
);
506 proto_tree_add_item(syslog_tree
, hf_syslog_msglen
, tvb
, 0, framing_leading_str_len
- 1, ENC_ASCII
);
509 proto_tree_add_uint(syslog_tree
, hf_syslog_facility
, tvb
, framing_leading_str_len
,
511 proto_tree_add_uint(syslog_tree
, hf_syslog_level
, tvb
, framing_leading_str_len
,
516 * RFC5424 defines a version field which is currently defined as '1'
517 * followed by a space (0x3120). Otherwise the message is probably
520 unsigned offset
= msg_off
;
521 if (msg_len
> 2 && tvb_get_ntohs(tvb
, msg_off
) == RFC5424_V
) {
522 offset
= dissect_rfc5424_syslog_message(syslog_tree
, tvb
, pinfo
, msg_off
);
523 } else if ( msg_len
> 15) {
524 offset
= dissect_rfc3164_syslog_message(syslog_tree
, tvb
, msg_off
);
526 if (offset
< tvb_reported_length(tvb
)) {
527 ti
= proto_tree_add_item(syslog_tree
, hf_syslog_msg
, tvb
, offset
,
528 tvb_reported_length_remaining(tvb
, offset
), ENC_ASCII
);
529 expert_add_info(pinfo
, ti
, &ei_syslog_msg_nonconformant
);
533 proto_item
*mtp3_item
;
534 mtp3_item
= proto_tree_add_boolean(syslog_tree
, hf_syslog_msu_present
,
535 tvb
, msg_off
, msg_len
, true);
536 proto_item_set_generated(mtp3_item
);
539 /* Call MTP dissector if encapsulated MSU was found... */
541 call_dissector(mtp_handle
, mtp3_tvb
, pinfo
, tree
);
544 return tvb_captured_length(tvb
);
548 dissect_syslog_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
552 When get_framed_syslog_pdu_len() returns >0, it has been checked for TCP Octet Counting Framing.
553 It can be handed over to tcp_dissect_pdus().
555 if(get_framed_syslog_pdu_len(pinfo
, tvb
, 0, data
) > 0) {
556 tcp_dissect_pdus(tvb
, pinfo
, tree
, true, MAX_FRAMING_DIGITS
+ 1, get_framed_syslog_pdu_len
, dissect_syslog
, data
);
557 return tvb_reported_length(tvb
);
560 /* If no framing was detected, simply pass it to the syslog dissector function */
561 return dissect_syslog(tvb
, pinfo
, tree
, data
);
564 /* Register the protocol with Wireshark */
565 void proto_register_syslog(void)
568 /* Setup list of header fields */
569 static hf_register_info hf
[] = {
571 { "Message Length", "syslog.msglen",
572 FT_STRING
, BASE_NONE
, NULL
, 0x0,
573 "Length of message (without this field)", HFILL
}
575 { &hf_syslog_facility
,
576 { "Facility", "syslog.facility",
577 FT_UINT16
, BASE_DEC
, VALS(syslog_facility_vals
), FACILITY_MASK
,
578 "Message facility", HFILL
}
581 { "Level", "syslog.level",
582 FT_UINT16
, BASE_DEC
, VALS(syslog_level_vals
), PRIORITY_MASK
,
583 "Message level", HFILL
}
585 { &hf_syslog_msu_present
,
586 { "SS7 MSU present", "syslog.msu_present",
587 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
588 "True if an SS7 MSU was detected in the syslog message", HFILL
}
590 { &hf_syslog_version
,
591 { "Version", "syslog.version",
592 FT_STRING
, BASE_NONE
, NULL
, 0x0,
593 "Syslog version", HFILL
}
595 { &hf_syslog_timestamp
,
596 { "Timestamp", "syslog.timestamp",
597 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
600 { &hf_syslog_timestamp_old
,
601 { "Timestamp (RFC3164)", "syslog.timestamp_rfc3164",
602 FT_STRING
, BASE_NONE
, NULL
, 0x0,
605 { &hf_syslog_hostname
,
606 { "Hostname", "syslog.hostname",
607 FT_STRING
, BASE_NONE
, NULL
, 0x0,
608 "The hostname that generated this message", HFILL
}
610 { &hf_syslog_appname
,
611 { "App Name", "syslog.appname",
612 FT_STRING
, BASE_NONE
, NULL
, 0x0,
613 "The name of the app that generated this message", HFILL
}
616 { "Process ID", "syslog.procid",
617 FT_STRING
, BASE_NONE
, NULL
, 0x0,
618 "The ID of the process that generated this message", HFILL
}
621 { "Message", "syslog.msg",
622 FT_STRING
, BASE_NONE
, NULL
, 0x0,
626 { "Message ID", "syslog.msgid",
627 FT_STRING
, BASE_NONE
, NULL
, 0x0,
631 { "BOM", "syslog.msgid.bom",
632 FT_UINT24
, BASE_HEX
, NULL
, 0x0,
633 "Byte Order Mark", HFILL
}
636 { "Structured Data", "syslog.sd",
637 FT_NONE
, BASE_NONE
, NULL
, 0x0,
640 { &hf_syslog_sd_element
,
641 { "Element", "syslog.sd.element",
642 FT_NONE
, BASE_NONE
, NULL
, 0x0,
643 "Structured Data Element", HFILL
}
645 { &hf_syslog_sd_element_name
,
646 { "Element Name", "syslog.sd.element.name",
647 FT_STRING
, BASE_NONE
, NULL
, 0x0,
648 "Structured Data Element Name", HFILL
}
650 { &hf_syslog_sd_param
,
651 { "Parameter", "syslog.sd.param",
652 FT_NONE
, BASE_NONE
, NULL
, 0x0,
653 "Structured Data Parameter", HFILL
}
655 { &hf_syslog_sd_param_name
,
656 { "Parameter Name", "syslog.sd.param.name",
657 FT_STRING
, BASE_NONE
, NULL
, 0x0,
658 "Structured Data Parameter Name", HFILL
}
660 { &hf_syslog_sd_param_value
,
661 { "Parameter Value", "syslog.sd.param.value",
662 FT_STRING
, BASE_NONE
, NULL
, 0x0,
663 "Structured Data Parameter Value", HFILL
}
667 /* Setup protocol subtree array */
668 static int *ett
[] = {
671 &ett_syslog_sd_element
,
675 static ei_register_info ei
[] = {
676 { &ei_syslog_msg_nonconformant
, { "syslog.msg.nonconformant", PI_PROTOCOL
, PI_NOTE
, "Message conforms to neither RFC 5424 nor RFC 3164; trailing data appended", EXPFILL
}}
679 expert_module_t
*expert_syslog
;
681 /* Register the protocol name and description */
682 proto_syslog
= proto_register_protocol("Syslog Message", "Syslog", "syslog");
684 /* Required function calls to register the header fields and subtrees used */
685 proto_register_field_array(proto_syslog
, hf
, array_length(hf
));
686 proto_register_subtree_array(ett
, array_length(ett
));
688 expert_syslog
= expert_register_protocol(proto_syslog
);
689 expert_register_field_array(expert_syslog
, ei
, array_length(ei
));
691 syslog_handle
= register_dissector("syslog", dissect_syslog
, proto_syslog
);
692 syslog_handle_tcp
= register_dissector("syslog.tcp", dissect_syslog_tcp
, proto_syslog
);
696 proto_reg_handoff_syslog(void)
698 dissector_add_uint_with_preference("udp.port", SYSLOG_PORT_UDP
, syslog_handle
);
699 dissector_add_for_decode_as_with_preference("tcp.port", syslog_handle_tcp
);
700 dissector_add_uint_with_preference("tls.port", SYSLOG_PORT_TLS
, syslog_handle_tcp
);
702 dissector_add_uint("acdr.media_type", ACDR_Info
, syslog_handle
);
704 /* Find the mtp3 dissector */
705 mtp_handle
= find_dissector_add_dependency("mtp3", proto_syslog
);
709 * Editor modelines - https://www.wireshark.org/tools/modelines.html
714 * indent-tabs-mode: nil
717 * ex: set shiftwidth=2 tabstop=8 expandtab:
718 * :indentSize=2:tabSize=8:noTabs=true: