liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #ifndef _LOG_CONFIG_H |
| 2 | #define _LOG_CONFIG_H |
| 3 | |
| 4 | |
| 5 | #define LOG_CONFIG_PATH "/etc/mbtk/mbtk_log.json" |
| 6 | |
| 7 | #define ROTATE_FILE_COUNT_MAX 10 |
| 8 | |
| 9 | struct filter_list_t { |
| 10 | char priority; |
| 11 | char *tag; |
| 12 | struct filter_list_t *next; |
| 13 | }; |
| 14 | |
| 15 | struct file_list_t { |
| 16 | int total; |
| 17 | int current; |
| 18 | char *base_file; |
| 19 | char *file[ROTATE_FILE_COUNT_MAX]; |
| 20 | }; |
| 21 | |
| 22 | typedef struct log_config_entry_t { |
| 23 | int enable; |
b.liu | 0f7ffad | 2024-11-06 19:57:27 +0800 | [diff] [blame] | 24 | char *name; |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 25 | int send_fd; |
b.liu | 0f7ffad | 2024-11-06 19:57:27 +0800 | [diff] [blame] | 26 | char *out_path; |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 27 | char *ip; |
| 28 | char *port; |
| 29 | int rotate_file_size; |
| 30 | int rotate_file_count; |
| 31 | int32_t log_format; |
| 32 | struct filter_list_t *filter_list; |
| 33 | } log_config_entry; |
| 34 | |
| 35 | int get_rotate_file(int fd, char *base_file, struct file_list_t *_file_list); |
| 36 | extern void* alog_thread(void* argv); |
| 37 | extern void* syslog_main(void* argv); |
| 38 | extern void* socket_log_thread(void* argv); |
| 39 | extern void* common_log_thread(void* argv); |
| 40 | |
| 41 | #endif // _LOG_CONFIG_H |