Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging issue with Twisted 15 #8

Closed
micheloosterhof opened this Issue Jun 21, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@micheloosterhof
Copy link
Member

commented Jun 21, 2015

2015-06-21 21:46:32+0400 [-] Unable to format event {'log_namespace': 'twisted.logger._global', 'log_level': <LogLevel=warn>, 'fileNow': '/usr/local/lib/python2.7/dist-packages/twisted/python/log.py', 'format': '%(log_legacy)s', 'lineNow
': 210, 'fileThen': '/usr/local/lib/python2.7/dist-packages/twisted/python/log.py', 'log_source': None, 'system': '-', 'lineThen': 210, 'log_logger': <Logger 'twisted.logger._global'>, 'time': 1434908792.281163, 'log_format': 'Warning: p
rimary log target selected twice at <{fileNow}:{lineNow}> - previously selected at <{fileThen:logThen}>. Remove one of the calls to beginLoggingTo.', 'message': (), 'log_time': 1434908792.281163}: Invalid conversion specification
2015-06-21 21:46:32+0400 [-] Log opened.
2015-06-21 21:46:32+0400 [-] twistd 15.2.1 (/usr/bin/python 2.7.6) starting up.
2015-06-21 21:46:32+0400 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2015-06-21 21:46:32+0400 [-] HoneyPotSSHFactory starting on 2222
2015-06-21 21:46:32+0400 [-] Starting factory <cowrie.core.ssh.HoneyPotSSHFactory instance at 0x7f784ce93908>
2015-06-21 21:47:44+0400 [-] Received SIGTERM, shutting down.
2015-06-21 21:47:44+0400 [-](TCP Port 2222 Closed)
2015-06-21 21:47:44+0400 [-] Stopping factory <cowrie.core.ssh.HoneyPotSSHFactory instance at 0x7f784ce93908>
2015-06-21 21:47:44+0400 [-] Main loop terminated.
2015-06-21 21:47:44+0400 [-] Server Shut Down.
2015-06-21 21:47:46+0400 [-] Unable to format event {'log_namespace': 'twisted.logger._global', 'log_level': <LogLevel=warn>, 'fileNow': '/usr/local/lib/python2.7/dist-packages/twisted/python/log.py', 'format': '%(log_legacy)s', 'lineNow
': 210, 'fileThen': '/usr/local/lib/python2.7/dist-packages/twisted/python/log.py', 'log_source': None, 'system': '-', 'lineThen': 210, 'log_logger': <Logger 'twisted.logger._global'>, 'time': 1434908866.354418, 'log_format': 'Warning: primary log target selected twice at <{fileNow}:{lineNow}> - previously selected at <{fileThen:logThen}>. Remove one of the calls to beginLoggingTo.', 'message': (), 'log_time': 1434908866.354418}: Invalid conversion specification
2015-06-21 21:47:46+0400 [-] Log opened.
2015-06-21 21:47:46+0400 [-] twistd 15.2.1 (/usr/bin/python 2.7.6) starting up.
2015-06-21 21:47:46+0400 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2015-06-21 21:47:46+0400 [-] HoneyPotSSHFactory starting on 2222
2015-06-21 21:47:46+0400 [-] Starting factory <cowrie.core.ssh.HoneyPotSSHFactory instance at 0x7f3f4d3107e8>
2015-06-21 21:47:53+0400 [cowrie.core.ssh.HoneyPotSSHFactory] New connection: 127.0.0.1:42517 (127.0.0.1:2222) [session: 0]
2015-06-21 21:47:53+0400 [-] Temporarily disabling observer LegacyLogObserverWrapper(<bound method Output.emit of <cowrie.output.jsonlog.Output object at 0x7f3f4d324190>>) due to exception: [Failure instance: Traceback: <type 'exceptions.TypeError'>: <LogLevel=info> is not JSON serializable
/home/michel/cowrie/cowrie/core/ssh.py:218:connectionMade
/usr/local/lib/python2.7/dist-packages/twisted/python/threadable.py:53:sync
/usr/local/lib/python2.7/dist-packages/twisted/python/log.py:282:msg
/usr/local/lib/python2.7/dist-packages/twisted/logger/_legacy.py:154:publishToNewObserver
--- ---
/usr/local/lib/python2.7/dist-packages/twisted/logger/_observer.py:131:call
/usr/local/lib/python2.7/dist-packages/twisted/logger/_legacy.py:93:call
/home/michel/cowrie/cowrie/core/output.py:153:emit
/home/michel/cowrie/cowrie/output/jsonlog.py:52:write
/usr/lib/python2.7/json/init.py:189:dump
/usr/lib/python2.7/json/encoder.py:434:_iterencode
/usr/lib/python2.7/json/encoder.py:408:_iterencode_dict
/usr/lib/python2.7/json/encoder.py:442:_iterencode
/usr/lib/python2.7/json/encoder.py:184:default
]
Traceback (most recent call last):
File "/home/michel/cowrie/cowrie/core/ssh.py", line 218, in connectionMade
sessionno=self.transport.sessionno)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/threadable.py", line 53, in sync
return function(self, _args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 282, in msg
_publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
File "/usr/local/lib/python2.7/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
observer(eventDict)
--- ---
File "/usr/local/lib/python2.7/dist-packages/twisted/logger/_observer.py", line 131, in call
observer(event)
File "/usr/local/lib/python2.7/dist-packages/twisted/logger/_legacy.py", line 93, in call
self.legacyObserver(event)
File "/home/michel/cowrie/cowrie/core/output.py", line 153, in emit
self.write(ev)
File "/home/michel/cowrie/cowrie/output/jsonlog.py", line 52, in write
json.dump(logentry, self.outfile)
File "/usr/lib/python2.7/json/init.py", line 189, in dump
for chunk in iterable:
File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
for chunk in _iterencode_dict(o, _current_indent_level):
File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
for chunk in chunks:
File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
exceptions.TypeError: <LogLevel=info> is not JSON serializable

@micheloosterhof

This comment has been minimized.

Copy link
Member Author

commented Jun 21, 2015

Seems to be related to the new Twisted logging interface
https://twistedmatrix.com/documents/current/core/howto/logging.html

@micheloosterhof

This comment has been minimized.

Copy link
Member Author

commented Jun 21, 2015

Fixed at 1858542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.