Discussion:
Is it possible to extend log message?
(too old to reply)
Nico Kadel-Garcia
2016-03-28 11:04:27 UTC
Permalink
On Mon, Mar 28, 2016 at 6:54 AM, Nakai Toru (Technical Support)
Hello folks,
Is it possible to extend log message as large as PATH_MAX?
Current length of message format including file path is small against linux PATH_MAX, 4096.
diff --git a/log.c b/log.c
index ad12930..95df4a9 100644
--- a/log.c
+++ b/log.c
@@ -359,7 +359,7 @@ log_redirect_stderr_to(const char *logfile)
log_stderr_fd = fd;
}
-#define MSGBUFSIZ 1024
+#define MSGBUFSIZ 5192
void
set_log_handler(log_handler_fn *handler, void *ctx)
@@ -448,11 +448,11 @@ do_log(LogLevel level, const char *fmt, va_list args)
} else {
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sd
- syslog_r(pri, &sdata, "%.500s", fmtbuf);
+ syslog_r(pri, &sdata, "%s", fmtbuf);
closelog_r(&sdata);
#else
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
- syslog(pri, "%.500s", fmtbuf);
+ syslog(pri, "%s", fmtbuf);
closelog();
#endif
}
Thanks
nakai
Possible? Probably, But what precisely were you thinking needs more
than 500 characters?
Nakai Toru (Technical Support)
2016-03-28 11:16:06 UTC
Permalink
Post by Nico Kadel-Garcia
Possible? Probably, But what precisely were you thinking needs more
than 500 characters?
Because of the message is suppressed if the path name is very long as following.

Mar 28 00:00:00 hostA sftp-server[123]: set "/very/long/path/name/here" mod
^^^^

So we can't see what "modtime" is set in this case.

Thanks

nakai
Nico Kadel-Garcia
2016-03-28 12:07:59 UTC
Permalink
On Mon, Mar 28, 2016 at 7:16 AM, Nakai Toru (Technical Support)
Post by Nakai Toru (Technical Support)
Post by Nico Kadel-Garcia
Possible? Probably, But what precisely were you thinking needs more
than 500 characters?
Because of the message is suppressed if the path name is very long as
following.
Mar 28 00:00:00 hostA sftp-server[123]: set "/very/long/path/name/here" mod
^^^^
So we can't see what "modtime" is set in this case.
Thanks
nakai
Wouldn't it be much, much easier not to use such long paths? And
generally easier for your userbase to work with?
Dan Yefihmov
2016-03-28 12:24:27 UTC
Permalink
Post by Nico Kadel-Garcia
Wouldn't it be much, much easier not to use such long paths? And
generally easier for your userbase to work with?
Probably. But the software must be malleable enough anyway, just to not dictate it's users TheOnlyRightWayToOperateThatTheLordDecidedOnceForever.
--
Sincerely Yours, Dan.
Michael Stone
2016-03-28 13:37:42 UTC
Permalink
Post by Nico Kadel-Garcia
Wouldn't it be much, much easier not to use such long paths? And
generally easier for your userbase to work with?
Yeah, and of course for potentially security-sensitive log messages,
make sure you ask the bad guys to not use long paths either.

Mike Stone

Loading...