1# Copyright (c) 2021 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4# Immediate mode cannot be used with network backend as it would cause the sent
5# rsyslog message to be malformed.
6config LOG_BACKEND_NET
7	bool "Networking backend"
8	depends on NETWORKING && (NET_UDP || NET_TCP) && NET_SOCKETS && !LOG_MODE_IMMEDIATE
9	depends on POSIX_C_LANG_SUPPORT_R
10	help
11	  Send syslog messages to network server.
12	  See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP) and
13	  RFC 6587 (syslog over TCP) specifications for details.
14
15if LOG_BACKEND_NET
16
17config LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
18	bool "Print structured data according to RFC 5424"
19	help
20	  Print additional structured data as described in
21	  RFC 5424 chapter 6.3. Note that this might increase the
22	  length of the syslog message a lot.
23
24config LOG_BACKEND_NET_RFC5424_SDATA_TZKNOWN
25	bool "RFC 5424 chapter 7.1.1 tzKnown field"
26	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
27	help
28	  The tzKnown parameter indicates whether the originator knows its time zone.
29	  See RFC 5424 chapter 7.1 for details.
30
31config LOG_BACKEND_NET_RFC5424_SDATA_ISSYNCED
32	bool "RFC 5424 chapter 7.1.2 isSynced field"
33	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
34	help
35	  The isSynced parameter indicates whether the originator is
36	  synchronized to a reliable external time source, e.g., via NTP.
37	  See RFC 5424 chapter 7.1 for details.
38
39config LOG_BACKEND_NET_RFC5424_SDATA_SOFTWARE
40	bool "RFC 5424 chapter 7.2.3 software description field"
41	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
42	help
43	  Software description parameter uniquely identifies the software that
44	  generated the message.
45	  See RFC 5424 chapter 7.2 for details.
46
47config LOG_BACKEND_NET_RFC5424_SDATA_SOFTWARE_VALUE
48	string "RFC 5424 chapter 7.2.3 software field value"
49	default "zephyr"
50	depends on LOG_BACKEND_NET_RFC5424_SDATA_SOFTWARE
51	help
52	  User defined value for the software field.
53	  See RFC 5424 chapter 7.2.3 for details.
54
55config LOG_BACKEND_NET_RFC5424_SDATA_SOFTWARE_VERSION
56	bool "RFC 5424 chapter 7.2.4 software version field"
57	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
58	help
59	  Software version parameter uniquely identifies the software that
60	  generated the message.
61	  See RFC 5424 chapter 7.2.4 for details.
62
63config LOG_BACKEND_NET_RFC5424_SDATA_SEQID
64	bool "RFC 5424 chapter 7.3.1 sequence id field"
65	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
66	help
67	  Sequence id parameter tracks the sequence in which the
68	  originator submits messages to the syslog transport for sending.
69	  See RFC 5424 chapter 7.3.1 for details.
70
71config LOG_BACKEND_NET_RFC5424_SDATA_UPTIME
72	bool "RFC 5424 chapter 7.3.2 system uptime field"
73	depends on LOG_BACKEND_NET_RFC5424_STRUCTURED_DATA
74	help
75	  The system uptime parameter tracks the "time (in hundredths of a
76	  second) since the network management portion of the system was last
77	  re-initialized." For Zephyr this is currently interpreted as the
78	  system uptime.
79	  See RFC 5424 chapter 7.3.2 for details.
80
81config LOG_BACKEND_NET_SERVER
82	string "Syslog server IP address"
83	help
84	  This can be either IPv4 or IPv6 address.
85	  Server listen UDP port number can be configured here too.
86	  Following syntax is supported:
87	  192.0.2.1:514
88	  192.0.2.42
89	  [2001:db8::1]:514
90	  [2001:db8::2]
91	  2001:db::42
92	  If you want to use TCP, add "tcp://" in front of the address
93	  like this
94	  tcp://192.0.2.1:514
95	  tcp://192.0.2.42
96	  tcp://[2001:db8::1]:514
97	  UDP is used by default if the URI is missing.
98
99config LOG_BACKEND_NET_MAX_BUF_SIZE
100	int "Max syslog message size"
101	range 64 1180
102	default 1180 if NET_IPV6
103	default 480 if NET_IPV4
104	default 256
105	help
106	  As each syslog message needs to fit to UDP packet, set this value
107	  so that messages are not truncated.
108	  The RFC 5426 recommends that for IPv4 the size is 480 octets and for
109	  IPv6 the size is 1180 octets. As each buffer will use RAM, the value
110	  should be selected so that typical messages will fit the buffer.
111
112config LOG_BACKEND_NET_AUTOSTART
113	bool "Automatically start networking backend"
114	default y if NET_CONFIG_NEED_IPV4 || NET_CONFIG_NEED_IPV6
115	help
116	  When enabled automatically start the networking backend on
117	  application start. If no routes to the logging server are available
118	  on application startup, this must be set to n and the backend must be
119	  started by the application later on. Otherwise the logging
120	  thread might block.
121
122config LOG_BACKEND_NET_USE_DHCPV4_OPTION
123	bool "Use DHCPv4 Log Server Option to configure syslog server"
124	depends on NET_DHCPV4
125	help
126	  When enabled the syslog server IP address is read from the DHCPv4
127	  Log Server Option (7).
128
129backend = NET
130backend-str = net
131source "subsys/logging/Kconfig.template.log_format_config"
132
133endif # LOG_BACKEND_NET
134