SysLog Class

For programmers to need to analyze syslog of RFC3164 or RFC5424 by python,this tested source code is useful.

Output is python dictionary format as followings:

  • RFC3164
    [{‘datetime’: ‘Oct 28 11:46:20’}, {‘hostname’: ‘swata-VF-AD4S’}, {‘message’: ‘systemd[1]: NetworkManager-dispatcher.service: Succeeded.’}], [{‘datetime’: ‘Oct 28 11:47:35’}, {‘hostname’: ‘swata-VF-AD4S’}, {‘message’: ‘kernel: [ 2565.200606] perf: interrupt took too long (4946 > 4943), lowering kernel.perf_event_max_sample_rate to 40250’}]
  • RFC5424
    [{‘priority’: ’34’}, {‘version’: ‘1’}, {‘datetime’: ‘2021-08-16T22:10:01.000Z’}, {‘hostname’: ‘mymachine’}, {‘message’: ‘myapplication 2017 ID11 BOMmyapplication has started’}]

Specification

IDSTCD_0000000011
LanguagePython
Steps77
PurposeAnalyze syslog .
FunctionAnalyze syslog of RFC3164.
Analyze syslog of RFC5424.
EnvironmentUbuntu 20.04.4 LTS
Anaconda3(Python 3.9.7)
IDE : Visual Studio Code
Restrictionfree license
You can use source code copy as owner .
You can customize and distribute it freely.
Price7 dollars or 700 yen
(Pay with PayPal)
Referenceshttps://tex2e.github.io/rfc-translater/html/rfc3164.html
https://tex2e.github.io/rfc-translater/html/rfc5424.html

https://www.oresamalabo.net/entry/2020/07/19/200717

Source Code

Test Result

NOtest caseresult
01syslog file of RFC3164OK
02syslog file of RFC5424OK

Test Code

*) Modify “path” along your PC environment.

History

10/3/2023 created

Provider Profile

Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !

Download

Get download password

Following files and data are zipped.

├── SysLogClass.py
├── syslog_RFC3164.txt
└── syslog_RFC5424.txt

Remarks

None

Comments

Copied title and URL