ulule/python-logstash-formatter

Can I ignore some field

Opened this issue · 2 comments

Greeting. I find the package is useful and hope you don't mind that I ask a silly question.
In the example, it show the default log string like this.

{"@version": 1,
 "account": "pyr",
 "lineno": 1,
 "levelno": 30,
 "filename": "test.py",
 "thread": 140566036444928,
 "@timestamp": "2015-03-30T09:46:23.000Z",
 "threadName": "MainThread",
 "relativeCreated": 51079.52117919922,
 "process": 10787,
 "source_host": "phoenix.spootnik.org",
 "processName": "MainProcess",
 "pathname": "test.py",
 "args": [],
 "module": "test",
 "msecs": 999.9005794525146,
 "created": 1427708782.9999006,
 "name": "root",
 "stack_info": null,
 "funcName": "<module>",
 "levelname": "WARNING",
 "message": "foo"}

However, I think the outpout information is too much for me. I learn that the necessary field the logstash need is @version and @timestamp. So can I set fmt to ignore some field then the result can be like this.

{"@version": 1,
 "@timestamp": "2015-03-30T09:46:23.000Z",
 "message": "foo"}

@memwey How did you resolve this problem can you help me out with any sample example

@memwey @AmanKrSoni is it possible to ignore some fields? Can you tell me how did u do it?