@@ -136,6 +136,61 @@ You can view the logging using python code or various tools.
136136 Open a browser and enter the IP address of the ESP32 in the address bar.
137137 
138138
139+
140+ # Using linux rsyslogd as logger
141+ We can forward logging to rsyslogd on Linux machine.
142+ Configure with protocol = UDP and port number = 514.
143+ ![ Image] ( https://github.com/user-attachments/assets/7d7c6cc2-2f58-40ec-8a3d-afbc80305403 )
144+
145+ Execute the following command on the Linux machine that will receive the logging data.
146+ ```
147+ $ cd /etc/rsyslog.d/
148+ $ sudo vi 99-remote.conf
149+ module(load="imudp")
150+ input(type="imudp" port="514")
151+
152+ if $fromhost-ip != '127.0.0.1' and $fromhost-ip != 'localhost' then {
153+ action(type="omfile" file="/var/log/remote")
154+ stop
155+ }
156+ $ sudo ufw enable
157+ $ sudo ufw allow 514/udp
158+ $ sudo systemctl restart rsyslog
159+ $ ss -nulp | grep 514
160+ UNCONN 0 0 0.0.0.0:514 0.0.0.0:*
161+ UNCONN 0 0 [::]:514 [::]:*
162+ $ sudo ufw status
163+ Status: active
164+
165+ To Action From
166+ -- ------ ----
167+ 514/udp ALLOW Anywhere
168+ 514/udp (v6) ALLOW Anywhere (v6)
169+ ```
170+
171+ esp-idf logging goes to /var/log/remote.
172+ ```
173+ $ tail -f /var/log/remote
174+ May 8 14:06:09 I (6688) MAIN: This is info level
175+ May 8 14:06:09 W (6698) MAIN: This is warning level
176+ May 8 14:06:09 E (6698) MAIN: This is error level
177+ May 8 14:06:09 I (6698) MAIN: freeRTOS version:V10.5.1
178+ May 8 14:06:09 I (6708) MAIN: NEWLIB version:4.3.0
179+ May 8 14:06:09 I (6708) MAIN: lwIP version:2-2-0-0
180+ May 8 14:06:09 I (6708) MAIN: ESP-IDF version:v5.4.1-dirty
181+ May 8 14:06:09 I (6718) MAIN: chip model is 1,
182+ May 8 14:06:09 I (6718) MAIN: chip with 2 CPU cores, WiFi/BT/BLE
183+ May 8 14:06:09 I (6718) MAIN: silicon revision 100
184+ May 8 14:06:09 I (6728) MAIN: 2MB external flash
185+ May 8 14:06:09 I (6728) main_task: Returned from app_main()
186+ May 8 14:06:09 I (7398) wifi:
187+ May 8 14:06:09 192.168.10.130 <ba-add>idx:0 (ifx:0, f8:b7:97:36:de:52), tid:5, ssn:0, winSize:64
188+ May 8 14:06:09 192.168.10.130
189+ May 8 14:06:10 I (7498) wifi:
190+ May 8 14:06:10 192.168.10.130 <ba-add>idx:1 (ifx:0, f8:b7:97:36:de:52), tid:0, ssn:4, winSize:64
191+ May 8 14:06:10 192.168.10.130
192+ ```
193+
139194# Disable ANSI Color control
140195You can disable this if you are unable to display ANSI color codes correctly.
141196![ ANSI-Color] ( https://github.com/user-attachments/assets/c36b5f74-e85a-48c0-b498-5cb5301f0d24 )
0 commit comments