-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timezone parsing error in pipeline of Fortinet module #19010
Comments
Pinging @elastic/siem (Team:SIEM) |
Also worth noting that the date format strings should be extended to accept both RFC 822 time zone and general time zone formats, using a capital
|
Thanks for the comments @usp-npe . I'm on it! :) I saw in your example logline that you mentioned it started with "timestamp=nanoseconds", but does it not start with "time="? Example test logs we have: |
here is log of mine, originating on a fortigate firewall, sent to fortianalyser and then forwarded from fortianalyser to filebeat:
@P1llus shout if you need any further logs or testing :) |
Here also a log line from my side:
Using Fortigate 6.x |
I updated the pipeline on my es cluster to incorporate the changes by @usp-npe, plus updated the fortinet.firewall.tz field to "UTC+01:00" and the data is now being indexed correctly. one thing i'm now noticing is event.start having the wrong value: "1970-01-01T01:00:01.591+01:00" do you see this also @usp-npe? |
If the time is set to the year 1970 then that happens when unix_time is not converted correctly or the format it expects. Currently the eventtime set by fortigate in our test logs used a different format so I had to strip the last 6 digits, ref:
Seems like fortinet has changed this (again), and I need to add a if condition to that, based on the length of the value. |
Yes, I observed the same:
|
@P1llus I know there is enough to do right now, but it seems there might need to be another style of log added to the Fortinet module, for logs that come from Forticlient (Fortinet's endpoint protection). Let me know if you'd like to see some samples. |
@fredtj Currently this is only from fortigate, so not from fortisandbox, fortianalyzer and such. What I plan on doing (or someone are always welcome to create a PR), is to create separate filesets for other fortinet products under the same module. That would of course require new log samples, but should be something outside of this specific issue. You could for example create a new issue under this beat repo, with a requirement and attach as much logging/data as possible. |
I have reached out to a few other fortinet users and gone through the documentation, but are unable to find the specific format used in the issues above. Before I apply any of the fixes it would be good to get some background into how the logs ended up with this time format to begin with, if its related to a change to Fortigate, then I should also be updating my test cases to ensure they are all tested. But if they are related to another fortinet product then we might need to move it to somewhere else. |
do you also forward your logs from faz? or send them directly from fw? I am wondering if it is faz that it is changing tz format. Even on FortiOS Log Referece documentation, tz does not have the format you are showing |
in my case the logs are forwarded from a fortigate firewall running 6.0.7 to fortianalyzer 6.2.5 then from there to filebeat. i'm not sure how easy it will be to test the firewall forwarding to filebeat directly, but i will try and let you know. |
Thanks for letting me know, the reason is that there is a difference in the module not working at all, and not working with Fortianalyzers. Since currently the module is only tested to retrieve logs directly from fortigate, and all our test data and parsing is based on that, then this would be an enhancement compared to a bug, and means that every other user that forwards directly from fortigate would still have a working module. |
OK so I checked and FortiAnalyzer is adding timestamp and tz field not present in the original message. I will open a ticket with Fortinet to discuss this as it does not seem to be documented anywhere. They are also adding tz field with complete different format even if it already exists in correct format in the original message. Regarding the fortinet.firewall.eventtime, on a 201D with 6.0.7 the event time is this format "1591964133" and in 6.2.2 is in this format "1591964043235739549". Reference doc for 6.2.2 suggests it should be epoch value, so the latter is wrong - I will also raise this with Fortinet. Regards, |
If the original event directly from fortinet has the possibility to have unix time in multiple formats I will add that to the parser, and I do understand that there will be more people interested in adding support for fortianalyzer, but that will then most likely be for a new release rather than a bug fix. |
about the epoch value, it is not wrong on 6.2.2, it is on nanoseconds now, that is why there are a whole lot more digits |
Thanks @enotspe , I've raised this with Fortinet anyway as their documentation for 6.2.2 says it should be epoch(seconds), but the link you provided documenting the new feature clearly explains it should now be in nanoseconds. On my firewall I'm seeing a mixture of both. |
I will add a fix for the difference between seconds and nanoseconds to support both 6.0 and 6.2, and will add the timezone format, but the fix for the weird formatting of timezones from fortianalyzer will still have to wait a little. |
A fix should be coming in for adding a new timezone format, and the eventtime conversion between seconds and nanoseconds. In case of adding support for fortianalyzer and its different timezone, I have added another issue to track fortianalyzer progress, as some more research needs to be done to see how much it affect different fortinet logs. |
Hi team, Thanks |
what method are you using to save the logs? you will need to strip that timestamp and IP to get things to work. |
@fredtj using syslog-ng free version to capture the logs Will parsing work if i have filebeat listen to the port instead of storing the logs in a file and reading? |
@Liqui12 - yes - that's what the module is designed to do - I'm using Filebeat to listen for the Fortinet logs and it all works great. If you want to keep logging to a file though, you should be able to have syslog-ng just dump the raw logs received from the Fortinet, things should work then. |
@fredtj Makes sense, but just curious, if i read the logs from a file using filebeat, is there an option to retain hostname since I am only storing raw events (without syslog header). |
You will have to look at syslog-ng templates, because you don't want to append anything to the data when saving it. I would still recommend to use the filebeat syslog input to have a syslog listener that you can send data directly to, but you can do it with syslog-ng as well as long as you retain the original message format. I can't remember since it has been some time, but you should be able to google something about storing the raw format for syslog-ng, either with Also please open new issues on known issues, and use the discuss forums for help https://discuss.elastic.co/ |
Good to see that I am not alone with timezone issues. The logs I get from fortianalyser have two tz fields.
As result the pipline fails about the array of the timezones and stops prozessing the ingest until the end. I have tried to overwrite the timezone in pipline.yml, but how to get it activated ? Restaring of filebeat didn't help. Best regards |
@UweW you could try stopping Filebeat, deleting the pipeline via Kibana (Stack Management -> Ingest Node Pipelines), it should be re-created when Filebeat starts Re the duplicate tz fields I've had a ticket open with Fortinet since June 2020, still no movement :( |
@fredtj , thank's for your fast response I will test that. |
The Fortinet module (#13245) seems to have issues with parsing timezone information from source logs. The issue being that the timezone is not formatted according to the standard expected by the (Java-based) timezone parser.
While parsing fortinet logs which are received via syslog (as described in https://www.elastic.co/guide/en/beats/filebeat/master//filebeat-module-fortinet.html), the following error is repored by the pipeline processor:
The original log line starts as follows:
From Java's documentation about the timezone parser, it becomes clear that timezones must always be two-digits, meaning that single-digit timezones like the one in my case would need to be prepended with a 0 to become UTC+02:00
Proposed solution
In module/fortinet/firewall/ingest/pipeline,yml, add a processor to update the
fortinet.firewall.tz
value and prepend a 0 if needed, before all other processors are executed...
The text was updated successfully, but these errors were encountered: