Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
08c30e46
Commit
08c30e46
authored
Nov 04, 2014
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志汇总查看
parent
654c2749
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
4 deletions
+46
-4
jumpserver.py
jumpserver.py
+2
-0
urls.py
webroot/AutoSa/AutoSa/urls.py
+1
-0
views.py
webroot/AutoSa/AutoSa/views.py
+17
-0
log_handler.py
webroot/AutoSa/log_handler.py
+6
-3
logHistory.html
webroot/AutoSa/templates/logHistory.html
+19
-0
logView.html
webroot/AutoSa/templates/logView.html
+1
-1
No files found.
jumpserver.py
View file @
08c30e46
...
@@ -19,6 +19,8 @@ import pxssh
...
@@ -19,6 +19,8 @@ import pxssh
import
pexpect
import
pexpect
cur_dir
=
os
.
path
.
dirname
(
__file__
)
cur_dir
=
os
.
path
.
dirname
(
__file__
)
if
not
cur_dir
:
cur_dir
=
"./"
sys
.
path
.
append
(
'
%
s/webroot/AutoSa/'
%
cur_dir
)
sys
.
path
.
append
(
'
%
s/webroot/AutoSa/'
%
cur_dir
)
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'AutoSa.settings'
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'AutoSa.settings'
...
...
webroot/AutoSa/AutoSa/urls.py
View file @
08c30e46
...
@@ -32,4 +32,5 @@ urlpatterns = patterns('',
...
@@ -32,4 +32,5 @@ urlpatterns = patterns('',
(
r'^upFile/$'
,
views
.
upFile
),
(
r'^upFile/$'
,
views
.
upFile
),
(
r'^downFile/$'
,
views
.
downFile
),
(
r'^downFile/$'
,
views
.
downFile
),
(
r'^logView/$'
,
views
.
logView
),
(
r'^logView/$'
,
views
.
logView
),
(
r'^logHistory/$'
,
views
.
logHistory
),
)
)
webroot/AutoSa/AutoSa/views.py
View file @
08c30e46
...
@@ -976,6 +976,23 @@ def logView(request):
...
@@ -976,6 +976,23 @@ def logView(request):
context_instance
=
RequestContext
(
request
))
context_instance
=
RequestContext
(
request
))
@admin_required
def
logHistory
(
request
):
if
request
.
method
==
'GET'
:
logid
=
request
.
GET
.
get
(
'id'
,
0
)
log
=
Logs
.
objects
.
filter
(
id
=
int
(
logid
))
if
log
:
log
=
log
[
0
]
log_his
=
"
%
s.his"
%
log
.
filename
if
os
.
path
.
isfile
(
log_his
):
f
=
open
(
log_his
)
content
=
f
.
read
()
return
render_to_response
(
content
)
...
...
webroot/AutoSa/log_handler.py
View file @
08c30e46
...
@@ -17,9 +17,12 @@ def log_hanler(logid):
...
@@ -17,9 +17,12 @@ def log_hanler(logid):
if
log
:
if
log
:
log
=
log
[
0
]
log
=
log
[
0
]
filename
=
log
.
logfile
filename
=
log
.
logfile
os
.
system
(
'cat
%
s | grep "DateTime" >
%
s.his'
%
(
filename
,
filename
))
ret1
=
os
.
system
(
'cat
%
s | grep "DateTime" >
%
s.his'
%
(
filename
,
filename
))
os
.
system
(
'cat
%
s | grep "
\
[.*@.*
\
][
\
$
\
#]" >>
%
s.his'
%
(
filename
,
filename
))
ret2
=
os
.
system
(
'cat
%
s | grep "
\
[.*@.*
\
][
\
$
\
#]" >>
%
s.his'
%
(
filename
,
filename
))
os
.
system
(
'cat
%
s | grep "EndTime" >>
%
s.his'
%
(
filename
,
filename
))
ret3
=
os
.
system
(
'cat
%
s | grep "EndTime" >>
%
s.his'
%
(
filename
,
filename
))
if
(
ret1
+
ret2
+
ret3
)
==
0
:
print
'Handler
%
ok.'
%
filename
def
set_finish
(
id
):
def
set_finish
(
id
):
...
...
webroot/AutoSa/templates/logHistory.html
0 → 100644
View file @
08c30e46
{% extends 'base.html' %}
{% block content %}
<div
id=
"myModal"
class=
"modal hide fade"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-hidden=
"true"
>
×
</button>
<h3
id=
"myModalLabel"
>
日志汇总
</h3>
</div>
<div
class=
"modal-body"
>
<p>
弹出层…
</p>
</div>
<div
class=
"modal-footer"
>
<button
class=
"btn"
data-dismiss=
"modal"
aria-hidden=
"true"
>
Close
</button>
<button
class=
"btn btn-primary"
>
Save changes
</button>
</div>
</div>
{% end block %}
\ No newline at end of file
webroot/AutoSa/templates/logView.html
View file @
08c30e46
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<td>
{{ log.user }}
</td>
<td>
{{ log.user }}
</td>
<td>
{{ log.host }}
</td>
<td>
{{ log.host }}
</td>
<td><a
href=
"#"
>
监控
</a></td>
<td><a
href=
"#"
>
监控
</a></td>
<td><a
href=
"
#
"
>
命令统计
</a></td>
<td><a
href=
"
/logHistory/?id={{ log.id }}
"
>
命令统计
</a></td>
<td><a
href=
"#"
>
阻断
</a>
</td>
<td><a
href=
"#"
>
阻断
</a>
</td>
<td>
{{ log.start_time|stamp2str }}
</td>
<td>
{{ log.start_time|stamp2str }}
</td>
<td>
{{ log.end_time|stamp2str }}
</td>
<td>
{{ log.end_time|stamp2str }}
</td>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment