Commit d67414e9 authored by Jukka Rissanen's avatar Jukka Rissanen
Browse files

samples: net: syslog: Remove the sample application



The application won't work anymore as it uses the old syslog
logging and networking is now converted to use the new logger
so there is no need for this sample application.

Signed-off-by: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
parent df13dcf9
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.8.2)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

samples/net/syslog_net/README.rst

deleted100644 → 0
+0 −52
Original line number Diff line number Diff line
.. _syslog-net-sample:

Syslog net Application
######################

Overview
********

This sample application enables a remote syslog service that will
send syslog messages to a remote server, as configured in ``prj.conf``.
See https://tools.ietf.org/html/rfc5424 and https://tools.ietf.org/html/rfc5424
for more details about syslog protocol over UDP.

The source code for this sample application can be found at:
:file:`samples/net/syslog_net`.

Requirements
************

- :ref:`networking_with_qemu`

Building and Running
********************

For configuring the remote IPv6 syslog server, set the following
variables in prj.conf file:

.. code-block:: console

	CONFIG_SYS_LOG_BACKEND_NET=y
	CONFIG_SYS_LOG_BACKEND_NET_SERVER="[2001:db8::2]:514"

Default port number is 514 if user does not specify a value.
The following syntax is supported for the server address
and port:

.. code-block:: console

	192.0.2.1:514
	192.0.2.42
	[2001:db8::1]:514
	[2001:db8::2]
	2001:db::42

Build syslog_net sample application like this:

.. zephyr-app-commands::
   :zephyr-app: samples/net/syslog_net
   :board: <board to use>
   :conf: <config file to use>
   :goals: build
   :compact:

samples/net/syslog_net/prj.conf

deleted100644 → 0
+0 −44
Original line number Diff line number Diff line
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_INIT_STACKS=y

CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5

CONFIG_NET_LOG=y
CONFIG_SYS_LOG=y
CONFIG_SYS_LOG_NET_LEVEL=4
CONFIG_SYS_LOG_SHOW_COLOR=y
CONFIG_NET_DEBUG_NET_PKT=y
#CONFIG_NET_DEBUG_DNS_RESOLVE=y
#CONFIG_NET_DEBUG_CONTEXT=y
#CONFIG_NET_DEBUG_CORE=y
#CONFIG_NET_DEBUG_IF=y
#CONFIG_NET_DEBUG_IPV4=y
#CONFIG_NET_DEBUG_IPV6=y
#CONFIG_NET_DEBUG_UDP=y
#CONFIG_NET_DEBUG_DHCPV4=y
#CONFIG_NET_DEBUG_L2_ETHERNET=y

CONFIG_NET_IPV6=y
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"

# syslog net backend config
CONFIG_SYS_LOG_BACKEND_NET=y
CONFIG_SYS_LOG_BACKEND_NET_SERVER="[2001:db8::2]:514"
#CONFIG_SYS_LOG_BACKEND_NET_SERVER="192.0.2.2:514"
CONFIG_SYS_LOG_DEFAULT_LEVEL=4
CONFIG_SYS_LOG_EXT_HOOK=y
+0 −8
Original line number Diff line number Diff line
sample:
  description: sys_log network backend
  name: sys_log_net
tests:
  test:
    harness: net
    depends_on: netif
    tags: net

samples/net/syslog_net/src/main.c

deleted100644 → 0
+0 −66
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018 Intel Corporation.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#if 1
#define SYS_LOG_DOMAIN "sys-log-net"
#define NET_SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG
#define NET_LOG_ENABLED 1
#endif

#include <zephyr.h>

#include <shell/legacy_shell.h>
#include <net/net_core.h>
#include <net/net_pkt.h>

/* Try to make sure that we have the peer MAC address resolved properly.
 * This is only needed in this sample application.
 */
static void init_app(void)
{
	struct sockaddr server_addr;
	char cmd[64];
	int ret;

	ret = net_ipaddr_parse(CONFIG_SYS_LOG_BACKEND_NET_SERVER,
			       sizeof(CONFIG_SYS_LOG_BACKEND_NET_SERVER) - 1,
			       &server_addr);
	if (!ret) {
		printk("Invalid syslog server address (%s)\n",
		       CONFIG_SYS_LOG_BACKEND_NET_SERVER);
		return;
	}

#if defined(CONFIG_NET_IPV6)
	if (server_addr.sa_family == AF_INET6) {
		snprintk(cmd, sizeof(cmd), "net ping %s",
			 CONFIG_NET_CONFIG_PEER_IPV6_ADDR);
		shell_exec(cmd);
		return;
	}
#endif

#if defined(CONFIG_NET_IPV4)
	if (server_addr.sa_family == AF_INET) {
		snprintk(cmd, sizeof(cmd), "net ping %s",
			 CONFIG_NET_CONFIG_PEER_IPV4_ADDR);
		shell_exec(cmd);
		return;
	}
#endif
}

void main(void)
{
	init_app();

	NET_DBG("Starting");
	NET_ERR("Error message");
	NET_WARN("Warning message");
	NET_INFO("Info message");
	NET_DBG("Debug message");
	NET_DBG("Stopping");
}