Changeset 06f58e662d9dcb103af43ff53f3bd7e72248cea4
- Timestamp:
- 02/26/08 23:16:31
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1204067791 +0000
- git-parent:
[7075a66d0bf9d872f936eee678a49cfbc5cd46c5]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1204067791 +0000
- Message:
prep for jlog transit over SSL
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r308a8d6 |
r06f58e6 |
|
| 28 | 28 | noit_console.o noit_console_state.o noit_console_telnet.o \ |
|---|
| 29 | 29 | noit_check.o noit_check_log.o noit_check_tools.o \ |
|---|
| 30 | | noit_module.o noit_conf.o noit_conf_checks.o noit_tokenizer.o |
|---|
| | 30 | noit_module.o noit_conf.o noit_conf_checks.o noit_tokenizer.o \ |
|---|
| | 31 | noit_jlog_listener.o |
|---|
| 31 | 32 | |
|---|
| 32 | 33 | STRATCON_OBJS=stratcond.o noit_listener.o \ |
|---|
| rf8c4ac7 |
r06f58e6 |
|
| 12 | 12 | <log name="debug" disabled="true"/> |
|---|
| 13 | 13 | </console_output> |
|---|
| 14 | | <!--<log name="feed" type="jlog" path="/var/log/noitd.feed" />--> |
|---|
| 15 | | <log name="feed"><outlet name="stderr"/></log> |
|---|
| | 14 | <log name="feed" type="jlog" path="/var/log/noitd.feed" /> |
|---|
| | 15 | <!--<log name="feed"><outlet name="stderr"/></log>--> |
|---|
| 16 | 16 | <feeds> |
|---|
| 17 | 17 | <outlet name="feed"/> |
|---|
| … | … | |
| 49 | 49 | </listener> |
|---|
| 50 | 50 | </consoles> |
|---|
| | 51 | <listener type="log_transit" address="*" port="34332"> |
|---|
| | 52 | <config><log>feed</log></config> |
|---|
| | 53 | </listener> |
|---|
| 51 | 54 | </listeners> |
|---|
| 52 | 55 | <checks max_initial_stutter="5"> |
|---|
| r2962688 |
r06f58e6 |
|
| 266 | 266 | |
|---|
| 267 | 267 | void |
|---|
| 268 | | noit_listener_reconfig() { |
|---|
| | 268 | noit_listener_reconfig(const char *toplevel) { |
|---|
| 269 | 269 | int i, cnt = 0; |
|---|
| 270 | 270 | noit_conf_section_t *listener_configs; |
|---|
| 271 | | |
|---|
| 272 | | listener_configs = noit_conf_get_sections(NULL, "/noit/listeners//listener", |
|---|
| 273 | | &cnt); |
|---|
| 274 | | noitL(noit_stderr, "Found %d /noit/listeners/listener stanzas\n", cnt); |
|---|
| | 271 | char path[256]; |
|---|
| | 272 | |
|---|
| | 273 | snprintf(path, sizeof(path), "/%s/listeners//listener", |
|---|
| | 274 | toplevel ? toplevel : "*"); |
|---|
| | 275 | listener_configs = noit_conf_get_sections(NULL, path, &cnt); |
|---|
| | 276 | noitL(noit_stderr, "Found %d %s stanzas\n", cnt, path); |
|---|
| 275 | 277 | for(i=0; i<cnt; i++) { |
|---|
| 276 | 278 | char address[256]; |
|---|
| … | … | |
| 322 | 324 | } |
|---|
| 323 | 325 | void |
|---|
| 324 | | noit_listener_init() { |
|---|
| | 326 | noit_listener_init(const char *toplevel) { |
|---|
| 325 | 327 | eventer_name_callback("noit_listener_acceptor", noit_listener_acceptor); |
|---|
| 326 | 328 | eventer_name_callback("noit_listener_accept_ssl", noit_listener_accept_ssl); |
|---|
| 327 | | noit_listener_reconfig(); |
|---|
| 328 | | } |
|---|
| 329 | | |
|---|
| | 329 | noit_listener_reconfig(toplevel); |
|---|
| | 330 | } |
|---|
| | 331 | |
|---|
| r2962688 |
r06f58e6 |
|
| 26 | 26 | } * listener_closure_t; |
|---|
| 27 | 27 | |
|---|
| 28 | | API_EXPORT(void) noit_listener_init(); |
|---|
| | 28 | API_EXPORT(void) noit_listener_init(const char *toplevel); |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | API_EXPORT(int) |
|---|
| r5f388ee |
r06f58e6 |
|
| 13 | 13 | #include "noit_listener.h" |
|---|
| 14 | 14 | #include "noit_console.h" |
|---|
| | 15 | #include "noit_jlog_listener.h" |
|---|
| 15 | 16 | #include "noit_module.h" |
|---|
| 16 | 17 | #include "noit_conf.h" |
|---|
| 17 | 18 | #include "noit_conf_checks.h" |
|---|
| 18 | 19 | |
|---|
| 19 | | static char *config_file = ETC_DIR "/noit.conf"; |
|---|
| | 20 | #define APPNAME "noit" |
|---|
| | 21 | |
|---|
| | 22 | static char *config_file = ETC_DIR "/" APPNAME ".conf"; |
|---|
| 20 | 23 | static int debug = 0; |
|---|
| 21 | 24 | |
|---|
| … | … | |
| 40 | 43 | int rv = 0; |
|---|
| 41 | 44 | noit_hash_table *table; |
|---|
| 42 | | table = noit_conf_get_hash(NULL, "/noit/eventer/config"); |
|---|
| | 45 | table = noit_conf_get_hash(NULL, "/" APPNAME "/eventer/config"); |
|---|
| 43 | 46 | if(table) { |
|---|
| 44 | 47 | noit_hash_iter iter = NOIT_HASH_ITER_ZERO; |
|---|
| … | … | |
| 67 | 70 | |
|---|
| 68 | 71 | /* Next load the configs */ |
|---|
| 69 | | noit_conf_init("noit"); |
|---|
| 70 | | noit_conf_checks_init("noit"); |
|---|
| | 72 | noit_conf_init(APPNAME); |
|---|
| | 73 | noit_conf_checks_init(APPNAME); |
|---|
| 71 | 74 | if(noit_conf_load(config_file) == -1) { |
|---|
| 72 | 75 | fprintf(stderr, "Cannot load config: '%s'\n", config_file); |
|---|
| … | … | |
| 74 | 77 | |
|---|
| 75 | 78 | /* Reinitialize the logging system now that we have a config */ |
|---|
| 76 | | noit_conf_log_init("noit"); |
|---|
| | 79 | noit_conf_log_init(APPNAME); |
|---|
| 77 | 80 | if(debug) |
|---|
| 78 | 81 | noit_debug->enabled = 1; |
|---|
| 79 | 82 | |
|---|
| 80 | 83 | /* Lastly, run through all other system inits */ |
|---|
| 81 | | if(!noit_conf_get_stringbuf(NULL, "/noit/eventer/@implementation", |
|---|
| | 84 | if(!noit_conf_get_stringbuf(NULL, "/" APPNAME "/eventer/@implementation", |
|---|
| 82 | 85 | conf_str, sizeof(conf_str))) { |
|---|
| 83 | 86 | noitL(noit_stderr, "Cannot find '%s' in configuration\n", |
|---|
| 84 | | "/noit/eventer/@implementation"); |
|---|
| | 87 | "/" APPNAME "/eventer/@implementation"); |
|---|
| 85 | 88 | exit(-1); |
|---|
| 86 | 89 | } |
|---|
| … | … | |
| 97 | 100 | exit(-1); |
|---|
| 98 | 101 | } |
|---|
| | 102 | /* Initialize all of our listeners */ |
|---|
| 99 | 103 | noit_console_init(); |
|---|
| | 104 | noit_jlog_listener_init(); |
|---|
| | 105 | |
|---|
| 100 | 106 | noit_module_init(); |
|---|
| 101 | 107 | noit_poller_init(); |
|---|
| 102 | | noit_listener_init(); |
|---|
| | 108 | noit_listener_init(APPNAME); |
|---|
| 103 | 109 | |
|---|
| 104 | 110 | eventer_loop(); |
|---|
| r308a8d6 |
r06f58e6 |
|
| 16 | 16 | #include "noit_conf.h" |
|---|
| 17 | 17 | |
|---|
| 18 | | static char *config_file = ETC_DIR "/stratcon.conf"; |
|---|
| | 18 | #define APPNAME "stratcon" |
|---|
| | 19 | static char *config_file = ETC_DIR "/" APPNAME ".conf"; |
|---|
| 19 | 20 | static int debug = 0; |
|---|
| 20 | 21 | |
|---|
| … | … | |
| 39 | 40 | int rv = 0; |
|---|
| 40 | 41 | noit_hash_table *table; |
|---|
| 41 | | table = noit_conf_get_hash(NULL, "/stratcon/eventer/config"); |
|---|
| | 42 | table = noit_conf_get_hash(NULL, "/" APPNAME "/eventer/config"); |
|---|
| 42 | 43 | if(table) { |
|---|
| 43 | 44 | noit_hash_iter iter = NOIT_HASH_ITER_ZERO; |
|---|
| … | … | |
| 66 | 67 | |
|---|
| 67 | 68 | /* Next load the configs */ |
|---|
| 68 | | noit_conf_init("stratcon"); |
|---|
| | 69 | noit_conf_init(APPNAME); |
|---|
| 69 | 70 | if(noit_conf_load(config_file) == -1) { |
|---|
| 70 | 71 | fprintf(stderr, "Cannot load config: '%s'\n", config_file); |
|---|
| … | … | |
| 72 | 73 | |
|---|
| 73 | 74 | /* Reinitialize the logging system now that we have a config */ |
|---|
| 74 | | noit_conf_log_init("stratcon"); |
|---|
| | 75 | noit_conf_log_init(APPNAME); |
|---|
| 75 | 76 | if(debug) |
|---|
| 76 | 77 | noit_debug->enabled = 1; |
|---|
| 77 | 78 | |
|---|
| 78 | 79 | /* Lastly, run through all other system inits */ |
|---|
| 79 | | if(!noit_conf_get_stringbuf(NULL, "/stratcon/eventer/@implementation", |
|---|
| | 80 | if(!noit_conf_get_stringbuf(NULL, "/" APPNAME "/eventer/@implementation", |
|---|
| 80 | 81 | conf_str, sizeof(conf_str))) { |
|---|
| 81 | 82 | noitL(noit_stderr, "Cannot find '%s' in configuration\n", |
|---|
| 82 | | "/stratcon/eventer/@implementation"); |
|---|
| | 83 | "/" APPNAME "/eventer/@implementation"); |
|---|
| 83 | 84 | exit(-1); |
|---|
| 84 | 85 | } |
|---|
| … | … | |
| 96 | 97 | } |
|---|
| 97 | 98 | noit_console_init(); |
|---|
| 98 | | noit_listener_init(); |
|---|
| | 99 | noit_listener_init(APPNAME); |
|---|
| 99 | 100 | |
|---|
| 100 | 101 | eventer_loop(); |
|---|
| ra136e61 |
r06f58e6 |
|
| 177 | 177 | ls->name = strdup(name); |
|---|
| 178 | 178 | ls->path = path ? strdup(path) : NULL; |
|---|
| | 179 | ls->type = type ? strdup(type) : NULL; |
|---|
| 179 | 180 | ls->enabled = 1; |
|---|
| 180 | 181 | ls->config = config; |
|---|
| … | … | |
| 212 | 213 | free(ls->name); |
|---|
| 213 | 214 | if(ls->path) free(ls->path); |
|---|
| | 215 | if(ls->type) free(ls->type); |
|---|
| 214 | 216 | free(ls); |
|---|
| 215 | 217 | return NULL; |
|---|
| r1648bed |
r06f58e6 |
|
| 25 | 25 | |
|---|
| 26 | 26 | typedef struct _noit_log_stream { |
|---|
| | 27 | char *type; |
|---|
| 27 | 28 | char *name; |
|---|
| 28 | 29 | int enabled; |
|---|