Browse Source

Merge pull request #3337 from jumpserver/dev_cmds_es

[Bugfix] 修复命令记录从 es 中获取失败(原因:时间日期格式不匹配)
pull/3344/head
BaiJiangJie 5 years ago committed by GitHub
parent
commit
ad3524f942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/terminal/backends/__init__.py
  2. 8
      apps/terminal/backends/command/es.py

1
apps/terminal/backends/__init__.py

@ -6,6 +6,7 @@ from common import utils
TYPE_ENGINE_MAPPING = {
'elasticsearch': 'terminal.backends.command.es',
'es': 'terminal.backends.command.es',
}

8
apps/terminal/backends/command/es.py

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
from datetime import datetime
from jms_storage.es import ESStorage
from .base import CommandBase
from .models import AbstractSessionCommand
@ -14,6 +15,13 @@ class CommandStore(ESStorage, CommandBase):
user=None, asset=None, system_user=None,
input=None, session=None):
if date_from is not None:
if isinstance(date_from, float):
date_from = datetime.fromtimestamp(date_from)
if date_to is not None:
if isinstance(date_to, float):
date_to = datetime.fromtimestamp(date_to)
data = super().filter(date_from=date_from, date_to=date_to,
user=user, asset=asset, system_user=system_user,
input=input, session=session)

Loading…
Cancel
Save