Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch backports to main-7.0.x #12007

Draft
wants to merge 13 commits into
base: main-7.0.x
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/log-stats.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2014 Open Information Security Foundation
/* Copyright (C) 2014-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
Expand Down Expand Up @@ -89,17 +89,16 @@ static int LogStatsLogger(ThreadVars *tv, void *thread_data, const StatsTable *s
int days = in_hours / 24;

MemBufferWriteString(aft->buffer, "----------------------------------------------"
"--------------------------------------\n");
"-----------------------------------------------------\n");
MemBufferWriteString(aft->buffer, "Date: %" PRId32 "/%" PRId32 "/%04d -- "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes the format, which may break tools that might parse them. Should we backport this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to move the PR to draft mode as there is consideration for this and other related items.

"%02d:%02d:%02d (uptime: %"PRId32"d, %02dh %02dm %02ds)\n",
tms->tm_mon + 1, tms->tm_mday, tms->tm_year + 1900, tms->tm_hour,
tms->tm_min, tms->tm_sec, days, hours, min, sec);
MemBufferWriteString(aft->buffer, "----------------------------------------------"
"--------------------------------------\n");
MemBufferWriteString(aft->buffer, "%-45s | %-25s | %-s\n", "Counter", "TM Name",
"Value");
"-----------------------------------------------------\n");
MemBufferWriteString(aft->buffer, "%-60s | %-25s | %-s\n", "Counter", "TM Name", "Value");
MemBufferWriteString(aft->buffer, "----------------------------------------------"
"--------------------------------------\n");
"-----------------------------------------------------\n");

/* global stats */
uint32_t u = 0;
Expand All @@ -112,7 +111,7 @@ static int LogStatsLogger(ThreadVars *tv, void *thread_data, const StatsTable *s
continue;

char line[256];
size_t len = snprintf(line, sizeof(line), "%-45s | %-25s | %-" PRIu64 "\n",
size_t len = snprintf(line, sizeof(line), "%-60s | %-25s | %-" PRIu64 "\n",
st->stats[u].name, st->stats[u].tm_name, st->stats[u].value);

/* since we can have many threads, the buffer might not be big enough.
Expand Down Expand Up @@ -207,7 +206,7 @@ TmEcode LogStatsLogThreadDeinit(ThreadVars *t, void *data)

/** \brief Create a new http log LogFileCtx.
* \param conf Pointer to ConfNode containing this loggers configuration.
* \return NULL if failure, LogFileCtx* to the file_ctx if succesful
* \return NULL if failure, LogFileCtx* to the file_ctx if successful
* */
static OutputInitResult LogStatsLogInitCtx(ConfNode *conf)
{
Expand Down
Loading