How to properly activate zephyr logs with network syslog backend to work over LTE-M for nrf9160 custom device?
How to properly activate zephyr logs with network syslog backend to work over LTE-M for nrf9160 custom device?
Are you saying this is what you're seeing too? Where are you outputting this syslog exactly on your end?
Best regards,
Simon
I meant that the example project I showed you is compiling and I can see the logs in the shell terminal. However, I do not see logs of the Syslog type (RFC 5424) on the server specified in the configuration (169.46.82.174:25736). In the example, I use a server that is provided by service https://papertrailapp.com. However, in reality there should be a full-fledged Syslog server.
What happens if you add "tcp://" in your CONFIG_LOG_BACKEND_NET_SERVER?
This causes an error:
[00:00:00.629,364] <inf> net_syslog_lte: Starting application... [00:00:00.684,783] <inf> net_syslog_lte: LTE connected successfully [00:00:00.684,814] <inf> net_syslog_lte: Begin logging to syslog... [00:00:00.684,844] <err> log_backend_net: Cannot configure syslog server address
Normally it looks like:
[00:00:00.651,672] <inf> net_syslog_lte: Starting application... [00:00:00.707,061] <inf> net_syslog_lte: LTE connected successfully [00:00:00.707,092] <inf> net_syslog_lte: Begin logging to syslog... [00:00:00.707,183] <dbg> net_utils: parse_ipv4: (main): IPv4 host 169.46.82.174 port 25736
but my log server is still empty...
Thank you for testing.
I'll see if we can find anything else after the weekend.
I will try to test it against Papertrail myself, but I will have to understand it properly first. Hoping to get some tests done before the end of the week at least.
Is there any good news?
Is there any good news?
Sorry for the delay, I had many issues with setting everything up.
For the last few days I have been trying to both integrate LTE into the syslog sample and try to integrate syslog into Asset Tracker v2 unsuccessfully.
But I finally have good news!
I have finally managed to SUCCESSFULLY send the logs to the papertrail server with the syslog sample on NCS 2.8.0.
My configuration right now is quite suboptimal and chaotic, but this is how I have managed to do it, so please test it as well, just change the papertrail address to your own.
prj.conf:
# nRF modem library CONFIG_NRF_MODEM_LIB=y # CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y # LTE link control CONFIG_LTE_LINK_CONTROL=y CONFIG_LTE_NETWORK_MODE_LTE_M=y CONFIG_NETWORKING=y CONFIG_NET_UDP=y # CONFIG_ENTROPY_GENERATOR=y # CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_INIT_STACKS=y CONFIG_NET_PKT_RX_COUNT=32 CONFIG_NET_PKT_TX_COUNT=32 CONFIG_NET_BUF_RX_COUNT=32 CONFIG_NET_BUF_TX_COUNT=32 CONFIG_NET_SOCKETS=y # CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3 # CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5 CONFIG_NET_LOG=y CONFIG_LOG=y # Deferred mode is required, synchronous mode does not work with network syslog # as it would cause the sent packet to be malformed (contains only 1 byte data) CONFIG_LOG_MODE_DEFERRED=y CONFIG_NET_IPV6=n CONFIG_NET_IPV4=y CONFIG_NET_DHCPV4=n # CONFIG_NET_SHELL=y # CONFIG_NET_CONFIG_SETTINGS=y # CONFIG_NET_CONFIG_NEED_IPV6=y # CONFIG_NET_CONFIG_NEED_IPV4=y # CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" # CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2" # CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" # CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2" # logging net backend config CONFIG_LOG_BACKEND_NET=y #CONFIG_LOG_BACKEND_NET_SERVER="[2001:db8::2]:514" CONFIG_LOG_BACKEND_NET_SERVER="169.46.nn.nnn:xxxxx" CONFIG_LOG_BACKEND_NET_SERVER="[logsn.papertrailapp.com]:xxxxx" # Get a proper libc by default in order to get working time function support CONFIG_REQUIRES_FULL_LIBC=y # Network CONFIG_NETWORKING=y CONFIG_NET_NATIVE=n CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_OFFLOAD=y CONFIG_NET_IPV6=n CONFIG_NET_IPV4=y # LTE link control ## Power saving timers. ### 320 hours PSM. CONFIG_LTE_PSM_REQ=y CONFIG_LTE_PSM_REQ_RPTAU="11000001" ### 20 seconds active time. CONFIG_LTE_PSM_REQ_RAT="00001010" ### Enable required modules CONFIG_LTE_LC_EDRX_MODULE=y CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE=y CONFIG_LTE_LC_PSM_MODULE=y CONFIG_LTE_LC_MODEM_SLEEP_MODULE=y CONFIG_NCS_SAMPLES_DEFAULTS=y # to get the logs on UART as well CONFIG_LOG_BACKEND_UART=y
And in main.c I just added the following at the start of the main{} function:
int main(void) { LOG_DBG("Modem config and start"); int err; err = nrf_modem_lib_init(); err = lte_lc_connect(); if (err) { LOG_DBG("Failed to connect to LTE network, error: %d\n", err); return -1; }
And if it still won't work for you, then please send me the log.
Best regards,
Michal