mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Feature: Record dumpfile filename in events
This commit is contained in:
parent
f6ca537283
commit
1f036d7707
@ -83,6 +83,7 @@ const char * event_extra_key_name(event_extra_key_t key)
|
||||
case EVENT_EXTRA_KEY_CLIENT_USERNAME: return "client-username"; break;
|
||||
case EVENT_EXTRA_KEY_CLIENT_USERAGENT: return "client-useragent"; break;
|
||||
case EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE: return "source-mediatype"; break;
|
||||
case EVENT_EXTRA_KEY_DUMPFILE_FILENAME: return "dumpfile-filename"; break;
|
||||
#ifndef DEVEL_LOGGING
|
||||
default: break;
|
||||
#endif
|
||||
@ -100,6 +101,7 @@ igloo_error_t event_to_string_renderer(const event_t *event, string_renderer_t *
|
||||
EVENT_EXTRA_KEY_CLIENT_ROLE,
|
||||
EVENT_EXTRA_KEY_CLIENT_USERNAME,
|
||||
EVENT_EXTRA_KEY_CLIENT_USERAGENT,
|
||||
EVENT_EXTRA_KEY_DUMPFILE_FILENAME,
|
||||
EVENT_EXTRA_LIST_END
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,7 @@ typedef enum {
|
||||
EVENT_EXTRA_KEY_CLIENT_USERNAME,
|
||||
EVENT_EXTRA_KEY_CLIENT_USERAGENT,
|
||||
EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE,
|
||||
EVENT_EXTRA_KEY_DUMPFILE_FILENAME,
|
||||
} event_extra_key_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -157,6 +157,7 @@ static inline void __setup_environ(ice_config_t *config, event_exec_t *self, eve
|
||||
__update_environ_with_key(event, "CLIENT_ROLE", EVENT_EXTRA_KEY_CLIENT_ROLE);
|
||||
__update_environ_with_key(event, "CLIENT_USERNAME", EVENT_EXTRA_KEY_CLIENT_USERNAME);
|
||||
__update_environ_with_key(event, "CLIENT_USERAGENT", EVENT_EXTRA_KEY_CLIENT_USERAGENT);
|
||||
__update_environ_with_key(event, "DUMPFILE_FILENAME", EVENT_EXTRA_KEY_DUMPFILE_FILENAME);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%lu", event->connection_id);
|
||||
__update_environ("CLIENT_ID", buf);
|
||||
|
@ -659,12 +659,12 @@ static bool source_open_dumpfile(source_t *source)
|
||||
source->dumpfile_start = curtime;
|
||||
stats_event(source->mount, "dumpfile_written", "0");
|
||||
stats_event_time_iso8601(source->mount, "dumpfile_start");
|
||||
event_emit_va("dumpfile-opened", EVENT_EXTRA_SOURCE, source, EVENT_EXTRA_LIST_END);
|
||||
event_emit_va("dumpfile-opened", EVENT_EXTRA_SOURCE, source, EVENT_EXTRA_KEY_DUMPFILE_FILENAME, filename, EVENT_EXTRA_LIST_END);
|
||||
return true;
|
||||
} else {
|
||||
ICECAST_LOG_WARN("Cannot open dump file for source %#H with filename %#H for appending: %s, disabling.",
|
||||
source->mount, source->dumpfilename, strerror(errno));
|
||||
event_emit_va("dumpfile-error", EVENT_EXTRA_SOURCE, source, EVENT_EXTRA_LIST_END);
|
||||
event_emit_va("dumpfile-error", EVENT_EXTRA_SOURCE, source, EVENT_EXTRA_KEY_DUMPFILE_FILENAME, filename, EVENT_EXTRA_LIST_END);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user