mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Feature: Added support to write a mark to the logfiles.
Note: This currently excludes the access.log Closes: #2343
This commit is contained in:
parent
fce09e5788
commit
0c29ddd915
@ -12,6 +12,7 @@
|
||||
<xsl:for-each select="resource[@name='logfiles']/value/value">
|
||||
<li><a href="?logfile={@value}"><xsl:value-of select="@value" /></a></li>
|
||||
</xsl:for-each>
|
||||
<li class="critical"><a href="marklog.xsl">Mark logfiles</a></li>
|
||||
</ul>
|
||||
<ul class="codeblock">
|
||||
<xsl:for-each select="resource[@name='logcontent']/value/value[@member='lines']/value">
|
||||
|
22
src/admin.c
22
src/admin.c
@ -92,6 +92,8 @@
|
||||
#define UPDATEMETADATA_HTML_REQUEST "updatemetadata.xsl"
|
||||
#define SHOWLOG_RAW_REQUEST "showlog"
|
||||
#define SHOWLOG_HTML_REQUEST "showlog.xsl"
|
||||
#define MARKLOG_RAW_REQUEST "marklog"
|
||||
#define MARKLOG_HTML_REQUEST "marklog.xsl"
|
||||
#define DEFAULT_RAW_REQUEST ""
|
||||
#define DEFAULT_HTML_REQUEST ""
|
||||
#define BUILDM3U_RAW_REQUEST "buildm3u"
|
||||
@ -116,6 +118,7 @@ static void command_manageauth (client_t *client, source_t *source, adm
|
||||
static void command_updatemetadata (client_t *client, source_t *source, admin_format_t response);
|
||||
static void command_buildm3u (client_t *client, source_t *source, admin_format_t response);
|
||||
static void command_show_log (client_t *client, source_t *source, admin_format_t response);
|
||||
static void command_mark_log (client_t *client, source_t *source, admin_format_t response);
|
||||
|
||||
static const admin_command_handler_t handlers[] = {
|
||||
{ "*", ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, NULL, NULL}, /* for ACL framework */
|
||||
@ -149,6 +152,8 @@ static const admin_command_handler_t handlers[] = {
|
||||
{ BUILDM3U_RAW_REQUEST, ADMINTYPE_MOUNT, ADMIN_FORMAT_RAW, command_buildm3u, NULL},
|
||||
{ SHOWLOG_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_show_log, NULL},
|
||||
{ SHOWLOG_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_show_log, NULL},
|
||||
{ MARKLOG_RAW_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_RAW, command_mark_log, NULL},
|
||||
{ MARKLOG_HTML_REQUEST, ADMINTYPE_GENERAL, ADMIN_FORMAT_HTML, command_mark_log, NULL},
|
||||
{ DEFAULT_HTML_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_stats, NULL},
|
||||
{ DEFAULT_RAW_REQUEST, ADMINTYPE_HYBRID, ADMIN_FORMAT_HTML, command_stats, NULL}
|
||||
};
|
||||
@ -1365,3 +1370,20 @@ static void command_show_log (client_t *client, source_t *source, adm
|
||||
|
||||
client_send_reportxml(client, report, DOCUMENT_DOMAIN_ADMIN, SHOWLOG_HTML_REQUEST, response, 200, NULL);
|
||||
}
|
||||
|
||||
static void command_mark_log (client_t *client, source_t *source, admin_format_t response)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr node;
|
||||
|
||||
doc = xmlNewDoc (XMLSTR("1.0"));
|
||||
node = admin_build_rootnode(doc, "iceresponse");
|
||||
xmlNewTextChild(node, NULL, XMLSTR("message"), XMLSTR("Logfiles marked"));
|
||||
xmlNewTextChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
|
||||
xmlDocSetRootElement(doc, node);
|
||||
|
||||
logging_mark(client->username, client->role);
|
||||
|
||||
admin_send_response(doc, client, response, ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "cfgfile.h"
|
||||
#include "util.h"
|
||||
|
||||
#define CATMODULE "logging"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
@ -201,6 +203,11 @@ void logging_playlist(const char *mount, const char *metadata, long listeners)
|
||||
metadata);
|
||||
}
|
||||
|
||||
void logging_mark(const char *username, const char *role)
|
||||
{
|
||||
ICECAST_LOG_INFO("######## -- MARK -- (requested by %#H with role %#H) ########", username, role);
|
||||
logging_playlist("/admin/", "-- MARK --", 0);
|
||||
}
|
||||
|
||||
void log_parse_failure (void *ctx, const char *fmt, ...)
|
||||
{
|
||||
|
@ -98,6 +98,7 @@ extern int playlistlog;
|
||||
|
||||
void logging_access(client_t *client);
|
||||
void logging_playlist(const char *mount, const char *metadata, long listeners);
|
||||
void logging_mark(const char *username, const char *role);
|
||||
void restart_logging (ice_config_t *config);
|
||||
void log_parse_failure (void *ctx, const char *fmt, ...);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user