Giter VIP home page Giter VIP logo

Comments (8)

molu8bits avatar molu8bits commented on September 21, 2024

Make sure you use appropriate parameters for your log (e.g. json format of modsecurity version).

You can try to run on smaller subset of log. E.g. limit modsec_audit.log to first 2-5 log entries.
If the error is the same with smaller log file then anonymize the log (e.g replace IP address/domain name) and send it to me. Add also information about your modsecurity version and arguments you passed to the parser.

from modsecurity-parser.

itdeveloper50 avatar itdeveloper50 commented on September 21, 2024

from modsecurity-parser.

molu8bits avatar molu8bits commented on September 21, 2024

Sorry for late reply but I haven't got any file and thought that problem was connected with the file.
I noticed that you used incorrect parameters.
Please use the following command with params:
python ./modsecurity-parser.py -f modsec_audit.log
When file is processed without errors then it should create a subfolder named "modsec_output". Inside of it there are 3 files:

  1. *.png with graph you look for
  2. *.xlsx file (second sheet also should have this graph
  3. *.json output

Please be noticed also that packages must be installed first with "pip install -r requirements.txt" . Please clone the latest commit as I've just updated it with the set of packages that should work with modsecurity-parser (they are quite old and were grabbed from Ubuntu18 but its possible to install them also with default python installation inside Ubuntu 20).

from modsecurity-parser.

itdeveloper50 avatar itdeveloper50 commented on September 21, 2024

Hello, thanks for reply.
This time I tried it on Linux Ubuntu 20.04. Same error:

python3 ./modsecurity-parser.py -f modsec_audit.log
inputFileName : modsec_audit.log
---------- modsec_audit events processed: 294    ----------
---------- modsec_audit events skipped by INCLUDED/EXCLUDED options or INVALID : 0 ----------
Traceback (most recent call last):
  File "./modsecurity-parser.py", line 689, in <module>
    outputWithGraphs = modsecViewGraphs(modsec_entries)
  File "./modsecurity-parser.py", line 360, in modsecViewGraphs
    event_times = list(map(lambda x: datetime.strptime(x.replace('--','-'), LOG_TIMESTAMP_FORMAT).replace(tzinfo=None), event_times1))
  File "./modsecurity-parser.py", line 360, in <lambda>
    event_times = list(map(lambda x: datetime.strptime(x.replace('--','-'), LOG_TIMESTAMP_FORMAT).replace(tzinfo=None), event_times1))
  File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '13/Aug/2022:00:06:11.341644 +0000' does not match format '%d/%b/%Y:%H:%M:%S %z'
root@nginks:/home/user15/modsecurity-parser#

from modsecurity-parser.

itdeveloper50 avatar itdeveloper50 commented on September 21, 2024

from modsecurity-parser.

molu8bits avatar molu8bits commented on September 21, 2024

Ahh, haven't noticed ValuError before.

Try to replace line from modsecurity_parser.py from:
LOG_TIMESTAMP_FORMAT = '%d/%b/%Y:%H:%M:%S %z'
to following one:
LOG_TIMESTAMP_FORMAT = '%d/%b/%Y:%H:%M:%S.%f %z'

from modsecurity-parser.

itdeveloper50 avatar itdeveloper50 commented on September 21, 2024

Thank you very much!
Issue has been resolved!
After editing LOG_TIMESTAMP_FORMAT as you mentioned above, now it is working.
Thank you again!

from modsecurity-parser.

molu8bits avatar molu8bits commented on September 21, 2024

Fixed with the latest 0.5.0 release

from modsecurity-parser.

Related Issues (20)

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.