Skip to content

Instantly share code, notes, and snippets.

@munim
Last active October 1, 2023 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save munim/a86a2d8d5cd4f4a11aa52c2aca458fe1 to your computer and use it in GitHub Desktop.
Save munim/a86a2d8d5cd4f4a11aa52c2aca458fe1 to your computer and use it in GitHub Desktop.
LNav format for Adobe Experience Manager (AEM)

LNav format for Adobe Experience Manager (AEM)

This is log format for https://lnav.org.

Regex can be improved but it works quite well for me. Send me pull requests if you have a better soution.

{
    "$schema": "https://lnav.org/schemas/format-v1.schema.json",
    "aem": {
        "description": "Format created by Abdul Munim - https://www.munim.net",
        "regex": {
            "default_request": {
                "pattern": "^(?<timestamp>\\d{2}\\.\\d{2}\\.\\d{4} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}) \\*(?<level>\\w+?)\\* \\[(?<requester>[\\w\\-\\.]+) \\[(?<request_id>\\w+)\\] (?<request_method>\\w+) (?<request_url>.+?(?= HTTP)) (?<req_version>.+)\\] (?<executor>\\S+?) (?<body>.*)$"
            },
            "replicator": {
                "pattern": "^(?<timestamp>\\d{2}\\.\\d{2}\\.\\d{4} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}) \\*(?<level>\\w+?)\\* \\[\\[(?<requester>[\\w\\-\\.\\:]+)\\] \\[(?<request_id>\\w+)\\] (?<request_method>\\w+) (?<request_url>.+?(?= HTTP)) (?<req_version>.+)\\] (?<executor>\\S+?) (?<body>.*)$"
            },
            "internal_services": {
                "pattern": "(?<timestamp>\\d{2}\\.\\d{2}\\.\\d{4} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}) \\*(?<level>\\w+?)\\* \\[(?<requester>[^\\[\\]]+?)\\] (?<executor>\\S+?) (?<body>.*$)"
            }
        },
        "value": {
            "level": {
                "kind": "string",
                "identifier": true
            },
            "req_version": {
                "kind": "string",
                "identifier": true
            },
            "request_id": {
                "kind": "string"
            },
            "request_method": {
                "kind": "string",
                "identifier": true
            },
            "request_url": {
                "kind": "string",
                "identifier": true
            },
            "requester": {
                "kind": "string",
                "identifier": true
            },
            "executor": {
                "kind": "string",
                "identifier": true
            },
            "body": {
                "kind": "string"
            }
        },
        "level-field" : "level",
		"level" : {
			"error" : "ERROR",
			"warning" : "WARN",
			"debug" : "DEBUG",
			"info" : "INFO"
		},
        "timestamp-format": [
            "%d.%m.%Y %H:%M:%S.%L"
        ],
        "sample": [
            {
                "line": "09.06.2023 09:38:31.380 *ERROR* [3.252.47.23 [1686303509939] POST /bin/example/search HTTP/1.1] net.munim.example.aem.internal.services.search.v2.SearchService Error in tag : {}"
            },
            {
                "line": "09.06.2023 01:40:25.027 *INFO* [[0:0:0:0:0:0:0:1] [1686274825025] GET /etc/replication/agents.author/publish1northeurope.test.html HTTP/1.1] com.day.cq.replication.impl.ReplicatorImpl Setting up replication with options: ReplicationOptions{synchronous=true, revision='null', suppressStatusUpdate=true, suppressVersions=true, filter=com.day.cq.replication.AgentIdFilter@1641b893, aggregateHandler=null}"
            },
            {
                "line": "09.06.2023 00:00:00.022 *INFO* [sling-default-5-com.day.cq.dam.similaritysearch.internal.scheduler.PeriodicAutoTaggingJob.4517] com.day.cq.dam.similaritysearch.internal.scheduler.PeriodicAutoTaggingJob Smart Tags not configured. Ignoring periodic job."
            }
        ]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment