Git Product home page Git Product logo

log-parser's Introduction

log-parser

Help

log-parser.py --help

usage: parse_log.py [-h] [-f FIELDS [FIELDS ...]] [-g FIELD REGEX] [-n] log [log ...]

positional arguments: log

optional arguments: -h, --help show this help message and exit -f FIELDS [FIELDS ...], --fields FIELDS [FIELDS ...] list des champs a afficher, par defaut tous -g FIELD REGEX, --grep FIELD REGEX n'afficher que les logs ou le champ FIELD correspond a REGEX -n, --field-names afficher les noms des champs pour chaque log

Example :

Logs of Fortinet FortiGate firewall

Source :

"itime=1601541343","date=2020-10-01","time=10:38:55","devid=FGxxxxxxxxxxx","vd=xxxx","type=""traffic""","subtype=""forward""","action=""accept""","appcat=""unscanned""","","","","","devname=xxxxx","dstcountry=""Reserved""","dstintf=""xxxx""","dstintfrole=""lan""","dstip=172.16.0.1","dstport=53","dtime=1601548735","duration=180","eventtime=1601541535","","idseq=xxxxxxxx","level=""notice""","logid=""0000000013""","logver=60","policyid=xx","policytype=""policy""","poluuid=""xxxxxx""","proto=17","rcvdbyte=117","","rcvdpkt=1","sentbyte=62","","sentpkt=1","service=""DNS""","sessionid=xxxxx","srccountry=""Reserved""","srcintf=xxxxx","srcintfrole=""undefined""","srcip=192.168.0.10","srcport=56948","trandisp=""noop""","","","","vpn=""xxxxx""","vpntype=""ipsec-dynamic"""

Command :

log_parser.py example.txt -f date time srcip dstip dstport

Result :

2020-10-01 10:38:55 192.168.0.10 172.16.0.1 53

log-parser's People

Contributors

romainmarcoux avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.