Giter Club home page Giter Club logo

fortilogcsv's People

Contributors

mrrothe avatar routetehpacketz avatar wl-dm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fortilogcsv's Issues

Blank CSV

Hi, I tried running the converter however the resulting .csv file was blank.

Convert.py Error

I get below error during the conversion of log using the script convert.py

Traceback (most recent call last):
File "C:\Temp\FW Logs\convert.py", line 20, in
for line in log_data:
File "C:\Users\akamburvenk2\AppData\Local\Programs\Python\Python38-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 191: character maps to

Convert log error

Hi, I got this issue when running the file:

File "D:\08.Library\Python\Convert log Forti\fortilogcsv.py", line 5
if len(sys.argv) 1
^
SyntaxError: invalid syntax

Would you please kindly help to see how to fix it?

non-utf characters conversion

Hello,
I have a problem when one entry contains the "=" sign. It happens when Fortimail has some emails containing non utf characters. These are saved inside the Fortimail csv log as "=?utf-8?q?" and then not converted correctly.
I am no expert on python, but the conversion should be:
search for the first "=" character, then everything that comes afterwards, until next comma is the text, so do not convert it.
Thank you in advance for support!

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 0: invalid continuation byte

Hello, getting the following error on both macos and linux (ubuntu):

Traceback (most recent call last):
File "/Users/tako/Tools/fortilogcsv/convert.py", line 21, in
for line in log_data:
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 714, in next
return next(self.reader)
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 645, in next
line = self.readline()
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 558, in readline
data = self.read(readsize, firstline=True)
File "/usr/local/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 504, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 0: invalid continuation byte

Best regards
mrtako

Fields without quotes are being omitted

Hey @mrrothe!

This is a very useful script! I do not use FortiAnalyzer and the Fortigates do not have the issue to download logs in CSV format, so I was pleased to find someone had already done the legwork of parsing through the field=value log format the Foritgates provide and converting it to CSV.

However, in running the script the first time I found that key fields were being omitted from the CSV the script generated. After comparing the raw log with the CSV, I found it was fields that did not contain quotation marks (dstip for example).

I have changed the regex to account for this and have tested it on quite a few lines from a raw log file. I wanted to create this issue in order to create a pull request with my changes.

Request: Handle multiple .log files

Not an issue more a feature request.

Currently I have multiple .log files from Fortinet.
If I process each file, the .csv column set and order are different between .csv files, which makes joining them difficult.
If this script could input multiple .log files, it seems to handle column sets fairly dynamically, and could output to one .csv file with it all in order.

Unless anyone knows of a better way to do this.

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.