diff --git a/mbtk/mbtk_logd/main.c b/mbtk/mbtk_logd/main.c
new file mode 100755
index 0000000..25dbdb1
--- /dev/null
+++ b/mbtk/mbtk_logd/main.c
@@ -0,0 +1,283 @@
+#include <stdio.h>
+#include <fcntl.h>
+#include <time.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <time.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "json/json.h"
+#include "json/printbuf.h"
+#include "log_config.h"
+
+// #define DEBUG 1
+
+#ifdef DEBUG
+#define mbtk_log(...)                    printf(__VA_ARGS__)
+#else
+#define mbtk_log(...)
+#endif
+
+static void handler_free(log_config_entry* listdata)
+{
+    int i, n;
+    struct filter_list_t* _filter_list = NULL;
+    log_config_entry* entry;
+
+    for (i = 0; i < 5; i++) {
+        entry = listdata + i;
+        if (entry->name) {
+            free(entry->name);
+            if (entry->out_path) {
+                free(entry->out_path);
+            }
+            if (entry->ip) {
+                free(entry->ip);
+            }
+            _filter_list = entry->filter_list;
+            for (n = 0; n < 10; n++) {
+                printf("%s %d: malloc %x!\n", __FUNCTION__, __LINE__, _filter_list);
+                if (_filter_list) {
+                    printf("%s %d: malloc %x!\n", __FUNCTION__, __LINE__, _filter_list->next);
+                    if (_filter_list->tag) {
+                        free(_filter_list->tag);
+                    }
+                    free(_filter_list);
+                    _filter_list = _filter_list->next;
+                } else {
+                    break;
+                }
+            }
+        } else {
+            break;
+        }
+    }
+}
+
+int parse_config(log_config_entry* listdata)
+{
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+    json_object* fileterjson = NULL;
+    json_object* fileter_listjson = NULL;
+    log_config_entry* entry;
+    int i, n, ret;
+    char* cmdval = NULL;
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    ret = json_object_object_get_ex(jsonobj, "logd", &tmpjson);
+    if (!ret) {
+        printf("get jsondata error ...\n");
+    }
+
+    if (NULL == tmpjson) {
+        printf("the tmpjson : [%s]\n", json_object_to_json_string(tmpjson));
+    }
+    /**获取total***/
+    cmdval = json_object_get_string(tmpjson);
+    printf("logd enable : %s\n", cmdval);
+    json_object_put(tmpjson);
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    for (i = 0 ; i < 5; i++) {
+        struct filter_list_t* _filter_list = NULL;
+        struct filter_list_t* tmp_filter_list = NULL;
+        datajson = json_object_array_get_idx(tmpjson, i);
+        if (NULL == datajson) {
+            mbtk_log("the datajson exit\n");
+            break;
+        }
+        entry = listdata + i;
+        json_object_object_get_ex(datajson, "enable", &listjson);
+        entry->enable = json_object_get_int(listjson);
+        mbtk_log("enable: %d\n", entry->enable);
+
+        json_object_object_get_ex(datajson, "name", &listjson);
+        entry->name = strdup(json_object_get_string(listjson));
+        mbtk_log("cmdval: %x, %s\n", entry->name, entry->name);
+
+        json_object_object_get_ex(datajson, "log_file", &listjson);
+        entry->out_path = strdup(json_object_get_string(listjson));
+        mbtk_log("cmdval: %s\n", entry->out_path);
+
+        json_object_object_get_ex(datajson, "log_stream", &listjson);
+        if (listjson) {
+            entry->ip = strdup(json_object_get_string(listjson));
+            cmdval = strstr(entry->ip, ":");
+            if (cmdval) {
+                entry->port = &cmdval[1];
+                cmdval[0] = 0;
+                mbtk_log("cmdval: %s [%s]\n", entry->ip, entry->port);
+            } else {
+                printf("Can't find port!!\n");
+                free(entry->ip);
+                entry->ip = NULL;
+            }
+        }
+        json_object_object_get_ex(datajson, "rotate_file_size", &listjson);
+        entry->rotate_file_size = json_object_get_int(listjson) * 1024;
+        mbtk_log("rotate_file_size: %d\n", entry->rotate_file_size);
+
+        json_object_object_get_ex(datajson, "rotate_file_count", &listjson);
+        entry->rotate_file_count = json_object_get_int(listjson);
+        mbtk_log("rotate_file_count: %d\n", entry->rotate_file_count);
+
+        json_object_object_get_ex(datajson, "filter_list", &listjson);
+        if (NULL == listjson) {
+            printf("%s %d: object failure!\n", __FUNCTION__, __LINE__);
+            json_object_put(listjson);
+            continue;
+        }
+        entry->filter_list = (struct filter_list_t*)malloc(sizeof(struct filter_list_t));
+        _filter_list = entry->filter_list;
+
+        for (n = 0 ; n < 5; n++) {
+            fileterjson = json_object_array_get_idx(listjson, n);
+            if (NULL == fileterjson) {
+                mbtk_log("the fileterjson exit\n");
+                free(tmp_filter_list->next);
+                tmp_filter_list->next = NULL;
+                break;
+            }
+            memset(_filter_list, 0, sizeof(struct filter_list_t));
+            json_object_object_get_ex(fileterjson, "priority", &fileter_listjson);
+            char* str = json_object_get_string(fileter_listjson);
+            if (str) {
+                _filter_list->priority = str[0];
+                mbtk_log("fileter_listjson: %c\n", _filter_list->priority);
+            }
+            json_object_object_get_ex(fileterjson, "tag", &fileter_listjson);
+            // if (NULL == fileter_listjson) {
+            //     printf("%s %d: object failure!\n", __FUNCTION__, __LINE__);
+            // }
+            str = json_object_get_string(fileter_listjson);
+            if (str) {
+                _filter_list->tag = strdup(str);
+                mbtk_log("fileter_listjson: %s\n", _filter_list->tag);
+            }
+            json_object_put(fileter_listjson);
+            _filter_list->next = (struct filter_list_t*)malloc(sizeof(struct filter_list_t));
+            if (NULL == _filter_list->next) {
+                printf("%s %d: malloc failure!\n", __FUNCTION__, __LINE__);
+                break;
+            }
+            tmp_filter_list = _filter_list;
+            _filter_list = _filter_list->next;
+        }
+        json_object_put(listjson);
+    }
+    json_object_put(tmpjson);
+
+    /***释放json对象***/
+    json_object_put(jsonobj);
+
+    return 0;
+}
+
+#define  LOGD_PID  "/var/run/mbtk_logd.pid"
+
+static int save_pid(void)
+{
+    pid_t process_id;
+    int fd, ret;
+    char buf[12] = {0};
+
+    process_id  = getpid();
+    if(access(LOGD_PID, F_OK) == 0)
+    {
+        printf("mbtk_logd 进程已经存在\n");
+        return -1;
+    }
+    fd = open(LOGD_PID, O_CREAT | O_WRONLY, 0600);
+    if (fd < 0) {
+        fprintf(stderr, "failed to open %s: %s\n", LOGD_PID, strerror(errno));
+        return -2;
+    }
+    snprintf(buf, sizeof(buf), "%d\n", process_id);
+    ret = write(fd, buf, strlen(buf));
+    close(fd);
+
+    if(ret > 0)
+        return 0;
+    else
+        return -2;
+}
+
+int main(int argc, char* argv[])
+{
+    log_config_entry listdata[5];
+    pthread_t pid[5] = {0};
+    int i, ret;
+    void* tret;
+
+    memset(listdata, 0, sizeof(log_config_entry) * 5);
+
+    ret = parse_config(listdata);
+    if (ret) {
+        return -1;
+    }
+    if(0 != save_pid())
+    {
+        printf("%s %d: logd exit!\n", __FUNCTION__, __LINE__);
+        return -1;
+    }
+
+    printf("logd %s start !\n", __FUNCTION__);
+
+    for (i = 0; i < 5; ++i) {
+        if (NULL == listdata[i].name) {
+            break;
+        }
+
+        if (0 == listdata[i].enable) {
+            printf("%s log disabled !\n", listdata[i].name);
+            continue;
+        }
+
+        if (0 == memcmp(listdata[i].name, "radio", 5)) {
+            ret = pthread_create(&pid[i], NULL, alog_thread, &listdata[i]);
+            if (ret != 0) {
+                fprintf(stderr, "\n%s: Failed to create pthread\n", __FUNCTION__);
+            }
+        } else if (0 == memcmp(listdata[i].name, "syslog", 6)) {
+            ret = pthread_create(&pid[i], NULL, syslog_main, &listdata[i]);
+            if (ret != 0) {
+                fprintf(stderr, "\n%s %d: Failed to create pthread\n", __FUNCTION__, __LINE__);
+            }
+        } else if (0 == memcmp(listdata[i].name, "local_socket", 12)) {
+            ret = pthread_create(&pid[i], NULL, socket_log_thread, &listdata[i]);
+            if (ret != 0) {
+                fprintf(stderr, "\n%s %d: Failed to create pthread\n", __FUNCTION__, __LINE__);
+            }
+        } else if (0 == memcmp(listdata[i].name, "/dev/tty", 8)) {
+            ret = pthread_create(&pid[i], NULL, common_log_thread, &listdata[i]);
+            if (ret != 0) {
+                fprintf(stderr, "\n%s %d: Failed to create pthread\n", __FUNCTION__, __LINE__);
+            }
+        }
+    }
+
+    for (i = 0; i < 5; ++i) {
+        if (NULL == listdata[i].name) {
+            break;
+        }
+        if (pid[i]) {
+            if (pthread_join(pid[i], &tret) != 0) {
+                printf("Join thread %d : %d error!\n", i, pid[i]);
+                exit(1);
+            }
+        }
+    }
+    handler_free(listdata);
+
+    return 0;
+}
