diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-06-17 13:50:30 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-06-17 13:50:30 +0200 |
commit | 9148f585020f5304b61241ed588630969d6f8c04 (patch) | |
tree | 3a4eb26622dbc6b6785c009c6572f2f30045cea0 | |
parent | 70dc5a3fc10fbf150e48f20a0c502c7bbe6f1bea (diff) |
output: XML: add infix in output file
This patch adds an infix to the XML file to avoid problems if we are
logging packets and flows at the same time. Thus, we create two
different XML files whose filename describes the sort of logging
information that it contains. It is also useful when listing files
at a quick sight.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | output/ulogd_output_XML.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/output/ulogd_output_XML.c b/output/ulogd_output_XML.c index 0ab843e..1ec9d8c 100644 --- a/output/ulogd_output_XML.c +++ b/output/ulogd_output_XML.c @@ -170,10 +170,21 @@ static int xml_open_file(struct ulogd_pluginstance *upi) struct xml_priv *op = (struct xml_priv *) &upi->private; int ret; + struct ulogd_pluginstance *input_plugin = + llist_entry(upi->stack->list.next, + struct ulogd_pluginstance, list); + char file_infix[strlen("flow")+1]; + + if (input_plugin->plugin->output.type & ULOGD_DTYPE_FLOW) + strcpy(file_infix, "flow"); + else if (input_plugin->plugin->output.type & ULOGD_DTYPE_RAW) + strcpy(file_infix, "pkt"); + now = time(NULL); tm = localtime(&now); ret = snprintf(filename, sizeof(filename), - "ulogd-%.2d%.2d%.4d-%.2d%.2d%.2d.xml", + "ulogd-%s-%.2d%.2d%.4d-%.2d%.2d%.2d.xml", + file_infix, tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); |