Skip to content
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

Pimp My Log does not load my custom Drupal log parser #126

Open
beerendlauwers opened this issue Sep 4, 2017 · 1 comment
Open

Pimp My Log does not load my custom Drupal log parser #126

beerendlauwers opened this issue Sep 4, 2017 · 1 comment

Comments

@beerendlauwers
Copy link

beerendlauwers commented Sep 4, 2017

Hi, I'm trying to parse some Drupal access logs, which look like this:

[03/Sep/2017:06:25:10 +0000] redacted.com GET / http_code=200 query= uid=0 php_pid=11216 php_time=21.930 queue_wait=0 request_id="v-95d25292-9070-11e7-a7b4-22000a56830c"
[03/Sep/2017:06:25:26 +0000] redacted.com OPTIONS /SysVol/redacted.com/Policies/%7b9DE645CA-E62E-4862-87F9-58F1F989A096%7d/User/Scripts/Logon http_code=404 query= uid=0 php_pid=11866 php_time=0.338 queue_wait=0 request_id="v-ac342ec0-9070-11e7-ad11-22000a56830c"
[03/Sep/2017:06:25:57 +0000] redacted.com GET /system/acquia-connector-status?key=fb81b0b167bd5a547ad6f089e7438943adffa45a&nonce=d4dfc599c051d1e4282e3b5a2012088e&stamp=1504419957 http_code=200 query=key=fb81b0b167bd5a547ad6f089e7438943adffa45a&nonce=d4dfc599c051d1e4282e3b5a2012088e&stamp=1504419957 uid=0 php_pid=12067 php_time=0.049 queue_wait=0 request_id="v-bf4804f0-9070-11e7-a2a4-22000a56830c"

Here's the parser:

"drupalaccess": {
      "display": "Drupal Access Log",
      "path": "\/var\/php\/logs\/drupal-requests.log",
      "refresh": 20,
      "max": 20,
      "notify": false,
      "format": {
        "regex": "||^\\[(.*)\/(.*)\/(.*):(.*):(.*):(.*) +(.*)\\] (.*) (.*) \/(.*)||",
        "match": {
          "Date": [
            1,
            " ",
            2,
            " ",
            3
          ],
          "Time": [
            4,
            ":",
            5,
            ":",
            6
          ],
          "Timezone": 7,
          "Source": 8,
          "Type": 9,
          "Request": [
            "/",
            10
          ]
        },
        "types": {
          "Date": "date:d M Y",
          "Time": "date:H:i:s",
          "Timezone": "txt",
          "Source": "txt",
          "Type": "txt",
          "Request": "txt"
        }
      }
    }

In the debugger, everything seems to work:

#10[03/Sep/2017:06:25:26 +0000] redacted.com OPTIONS /SysVol/redacted.com/Policies/%7b9DE645CA-E62E-4862-87F9-58F1F989A096%7d/User/Scripts/Logon http_code=404 query= uid=0 php_pid=11866 php_time=0.338 queue_wait=0 request_id="v-ac342ec0-9070-11e7-ad11-22000a56830c"
   Date    : 03 Sep 2017
   Time    : 06:25:26
   Timezone: +0000
   Source  : redacted.com
   Type    : OPTIONS
   Request : /SysVol/redacted.com/Policies/%7b9DE645CA-E62E-4862-87F9-58F1F989A096%7d/User/Scripts/Logon http_code=404 query= uid=0 php_pid=11866 php_time=0.338 queue_wait=0 request_id="v-ac342ec0-9070-11e7-ad11-22000a56830c"

#11[03/Sep/2017:06:25:10 +0000] redacted.com GET / http_code=200 query= uid=0 php_pid=11216 php_time=21.930 queue_wait=0 request_id="v-95d25292-9070-11e7-a7b4-22000a56830c"
   Date    : 03 Sep 2017
   Time    : 06:25:10
   Timezone: +0000
   Source  : redacted.com
   Type    : GET
   Request : / http_code=200 query= uid=0 php_pid=11216 php_time=21.930 queue_wait=0 request_id="v-95d25292-9070-11e7-a7b4-22000a56830c"

But when I loaded it into the JSON file and restarted the webserver, the log viewer doesn't seem to do anything. It's just stuck like this:

pimp-my-log-not-doing-anything

Are there any more extensive debugging methods available?

@potsky
Copy link
Owner

potsky commented Sep 10, 2017

Hi !

Indeed, it works but your configuration file should be something like this :

"drupalaccess": {
      "display": "Drupal Access Log",
      "path": "\/var\/php\/logs\/drupal-requests.log",
      "refresh": 20,
      "max": 20,
      "notify": false,
      "format": {
      "regex"    : "|^\\[(.*)/(.*)/(.*):(.*):(.*):(.*) \\+(.*)\\] (.*) (.*) (\\/(.*))|",
        "match": {
          "Date": [
            1,
            " ",
            2,
            " ",
            3
          ],
          "Time": [
            4,
            ":",
            5,
            ":",
            6
          ],
          "Timezone": 7,
          "Source": 8,
          "Type": 9,
          "Request": 10
        },
        "types": {
          "Date": "date:d M Y",
          "Time": "date:H:i:s",
          "Timezone": "txt",
          "Source": "txt",
          "Type": "txt",
          "Request": "txt"
        }
      }
    }

Double pipe in the regex is not correct. Does it work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants