<log>client-ip</log> in the configuration.
+Allow client-ip to be logged for each log entry. Speciy
+<log>client-ip</log> in the configuration.
+
Added support for limiting the number of initiating connections
from a single IP. limit-connect specifies a limit and if that
is reached a delay is introduced (just as limit-pdu, etc).
and the size of the APDU is logged.
</entry>
</row>
+ <row>
+ <entry><literal>client-ip</literal></entry>
+ <entry>
+ Log the client IP for each log entry. By default, the client IP
+ is only logged when a new session starts.
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
<screen><![CDATA[
<?xml version="1.0"?>
<!-- XML Schema for YAZ proxy config file.
- $Id: reference.xml,v 1.16 2006-04-06 10:30:16 adam Exp $
+ $Id: reference.xml,v 1.17 2006-04-06 12:04:19 adam Exp $
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
<?xml version="1.0"?>
-<!-- $Id: config.xml,v 1.17 2006-04-06 01:16:54 adam Exp $ -->
+<!-- $Id: config.xml,v 1.18 2006-04-06 12:04:19 adam Exp $ -->
<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.9/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<max-clients>30</max-clients>
<max-connect>10</max-connect>
<limit-connect>5</limit-connect>
- <log>client-requests server-requests</log>
+ <log>client-requests server-requests client-ip</log>
<docpath>doc</docpath>
</proxy>
-/* $Id: proxy.h,v 1.30 2006-04-06 01:16:55 adam Exp $
+/* $Id: proxy.h,v 1.31 2006-04-06 12:04:19 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
#define PROXY_LOG_APDU_SERVER 2
#define PROXY_LOG_REQ_CLIENT 4
#define PROXY_LOG_REQ_SERVER 8
+#define PROXY_LOG_IP_CLIENT 16
class Yaz_usemarcon;
class Yaz_ProxyConfig;
-/* $Id: yaz-proxy-config.cpp,v 1.28 2006-04-06 01:20:02 adam Exp $
+/* $Id: yaz-proxy-config.cpp,v 1.29 2006-04-06 12:04:19 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
*log_mask |= PROXY_LOG_REQ_CLIENT;
if (m_cp->mycmp(v, "server-requests", len))
*log_mask |= PROXY_LOG_REQ_SERVER;
+ if (m_cp->mycmp(v, "client-ip", len))
+ *log_mask |= PROXY_LOG_IP_CLIENT;
if (isdigit(*v))
*log_mask |= atoi(v);
if (*cp == ',')
-/* $Id: yaz-proxy.cpp,v 1.49 2006-04-06 01:16:55 adam Exp $
+/* $Id: yaz-proxy.cpp,v 1.50 2006-04-06 12:04:20 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
check_reconfigure();
char session_str[200];
- sprintf(session_str, "%ld:%d ", (long) time(0), m_session_no);
+ const char *peername = the_PDU_Observable->getpeername();
+ if (m_log_mask & PROXY_LOG_IP_CLIENT)
+ sprintf(session_str, "%ld:%d %s 0 ",
+ (long) time(0), m_session_no, peername);
+ else
+ sprintf(session_str, "%ld:%d 0 ",
+ (long) time(0), m_session_no);
m_session_no++;
- const char *peername = the_PDU_Observable->getpeername();
yaz_log (YLOG_LOG, "%sNew session %s", session_str, peername);
m_connect.cleanup(false);
void Yaz_Proxy::inc_request_no()
{
- char *cp = strchr(m_session_str, ' ');
- m_request_no++;
- if (cp)
+ char *cp = m_session_str + strlen(m_session_str)-1;
+ if (*cp == ' ')
+ cp--;
+ while (*cp && *cp != ' ')
+ cp--;
+ if (*cp)
sprintf(cp+1, "%d ", m_request_no);
}