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