Skip to content

Commit

Permalink
fix nginx format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Oct 6, 2023
1 parent 04bf501 commit f43877b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions import_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ def check_format_line(self, line):
try:
self.json = json.loads(line)

# Check if it contains these: "idsite", "referrer", and date".
# This is unique to nginx, we can use this to tell it apart from other json log formats.
if "idsite" in self.json and "referrer" in self.json and "date" in self.json:
# Check if it contains these: "referrer" and date".
# Those are currently not used in other detected json formats, so it should be enough
if "referrer" in self.json and "date" in self.json:
return True

return False
Expand Down Expand Up @@ -588,8 +588,8 @@ def get(self, key):
's3': RegexFormat('s3', _S3_LOG_FORMAT),
'icecast2': RegexFormat('icecast2', _ICECAST2_LOG_FORMAT),
'elb': RegexFormat('elb', _ELB_LOG_FORMAT, '%Y-%m-%dT%H:%M:%S'),
'nginx_json': NginxJsonFormat('nginx_json'),
'traefik_json': TraefikJsonFormat('traefik_json'),
'nginx_json': NginxJsonFormat('nginx_json'),
'ovh': RegexFormat('ovh', _OVH_FORMAT),
'haproxy': RegexFormat('haproxy', _HAPROXY_FORMAT, '%d/%b/%Y:%H:%M:%S.%f'),
'gandi': RegexFormat('gandi', _GANDI_SIMPLE_HOSTING_FORMAT, '%d/%b/%Y:%H:%M:%S')
Expand Down

0 comments on commit f43877b

Please sign in to comment.