fixed issue of download log option giving truncated file with fixed 2mb limit by making the limit option configurable.

This commit is contained in:
Shreyas Zare
2019-01-05 15:14:15 +05:30
parent 0d2837a5a7
commit 569b00dbe1
3 changed files with 9 additions and 4 deletions

View File

@@ -405,7 +405,12 @@ namespace DnsServerCore
string logFileName = pathParts[2];
string logFile = Path.Combine(_log.LogFolder, logFileName + ".log");
LogManager.DownloadLog(response, logFile, 2 * 1024 * 1024);
int limit = 0;
string strLimit = request.QueryString["limit"];
if (!string.IsNullOrEmpty(strLimit))
limit = int.Parse(strLimit);
LogManager.DownloadLog(response, logFile, limit * 1024 * 1024);
}
else
{

View File

@@ -34,7 +34,7 @@ namespace DnsServerCore
string _logFile;
StreamWriter _logOut;
DateTime _logDate;
readonly object _logFileLock = new object();
#endregion
@@ -117,7 +117,7 @@ namespace DnsServerCore
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment;filename=" + Path.GetFileName(logFile));
if (limit > fS.Length)
if ((limit > fS.Length) || (limit < 1))
limit = fS.Length;
OffsetStream oFS = new OffsetStream(fS, 0, limit);

View File

@@ -2651,7 +2651,7 @@ function viewLog(logFile) {
divLogViewer.show();
HTTPGetFileRequest({
url: "/log/" + logFile + "?token=" + token,
url: "/log/" + logFile + "?limit=2&token=" + token,
success: function (response) {
divLogViewerLoader.hide();