Salvage Oink logs in Rails.logger format

120 views Asked by At

A few weeks ago we installed Oink to analyze the poor memory performance of our Rails application. Unfortunately, we missed the boat on using the Hodel 3000 Compliant logger. After having a catastrophic memory event where we started paging 700 mb into swap, I went to the Oink analyzer only to realize it could not parse our logs in the current default Rails logger format.

Oink log entry in current format:

524072923066355726  2015-04-12T23:29:07 2015-04-13T00:45:44Z    7477731 myapp   54.82.73.66 Local7  Info    app/web.4   Oink Action: messages#create 
524072923066355727  2015-04-12T23:29:07 2015-04-13T00:45:44Z    7477731 myapp   54.82.73.66 Local7  Info    app/web.4   Memory usage: 614136 | PID: 12 
524072923070550016  2015-04-12T23:29:07 2015-04-13T00:45:44Z    7477731 myapp   54.82.73.66 Local7  Info    app/web.4   Instantiation Breakdown: Total: 1 | User: 1 
524072923070550017  2015-04-12T23:29:07 2015-04-13T00:45:44Z    7477731 myapp   54.82.73.66 Local7  Info    app/web.4   Oink Log Entry Complete 

Oink log entry in desired Hodel 3000 format.

Apr 12 23:29:07 4598489-yygjkg-2345 rails[12]: Oink Action: messages#create 
Apr 12 23:29:07 4598489-yygjkg-2345 rails[12]: Memory usage: 614136 | PID: 12 
Apr 12 23:29:07 4598489-yygjkg-2345 rails[12]: Instantiation Breakdown: Total: 1 | User: 1 
Apr 12 23:29:07 4598489-yygjkg-2345 rails[12]: Oink Log Entry Complete 

Is there any way I can salvage it? Does the top one even have all the necessary information?

1

There are 1 answers

0
NealJMD On

Once I found the format_message method in the Hodel 3000 compliant logger and realized that Oink was printing the PID in every Oink entry if not on every line, I decided to just reformat the logs with a script. If anyone else has this problem, you can use my script at https://github.com/NealJMD/oinkify/tree/master