make access log fetch compatible with Michael commit

This commit is contained in:
Usman Nasir
2020-02-03 17:30:24 +05:00
parent 0d6b7a9c4c
commit 829c8c8b59
4 changed files with 12 additions and 12 deletions

View File

@@ -297,10 +297,10 @@ class virtualHostUtilities:
print("0, %s file is symlinked." % (fileName))
return 0
numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), externalApp).split(" ")[0])
numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), 'nobody').split(" ")[0])
if numberOfTotalLines < 25:
data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), externalApp)
data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), 'nobody')
else:
if page == 1:
end = numberOfTotalLines
@@ -309,7 +309,7 @@ class virtualHostUtilities:
start = 1
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
command = "sed -n " + startingAndEnding + " " + fileName
data = ProcessUtilities.outputExecutioner(command, externalApp)
data = ProcessUtilities.outputExecutioner(command, 'nobody')
else:
end = numberOfTotalLines - ((page - 1) * 25)
start = end - 24
@@ -317,7 +317,7 @@ class virtualHostUtilities:
start = 1
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
command = "sed -n " + startingAndEnding + " " + fileName
data = ProcessUtilities.outputExecutioner(command, externalApp)
data = ProcessUtilities.outputExecutioner(command, 'nobody')
print(data)
return data
except BaseException as msg:

View File

@@ -194,7 +194,7 @@
<table class="table">
<thead>
<tr>
<th>Domain</th>
<th>Type</th>
<th>IP Address</th>
<th>Time</th>
<th>Resource</th>

View File

@@ -176,7 +176,7 @@
<table class="table">
<thead>
<tr>
<th>Domain</th>
<th>Type</th>
<th>IP Address</th>
<th>Time</th>
<th>Resource</th>

View File

@@ -1004,7 +1004,7 @@ class WebsiteManager:
if output.find("1,None") > -1:
final_json = json.dumps(
{'status': 0, 'logstatus': 0, 'error_message': "Not able to fetch logs, see CyberPanel main log file!"})
{'status': 0, 'logstatus': 0, 'error_message': "Not able to fetch logs, see CyberPanel main log file, Error: %s" % (output)})
return HttpResponse(final_json)
## get log ends here.
@@ -1017,11 +1017,11 @@ class WebsiteManager:
for items in reversed(data):
if len(items) > 10:
logData = items.split(" ")
domain = logData[0].strip('"')
ipAddress = logData[1]
time = (logData[4]).strip("[").strip("]")
resource = logData[7].strip('"')
size = logData[10].replace('"', '')
domain = logData[5].strip('"')
ipAddress = logData[0].strip('"')
time = (logData[3]).strip("[").strip("]")
resource = logData[6].strip('"')
size = logData[9].replace('"', '')
dic = {'domain': domain,
'ipAddress': ipAddress,