如何在没有时间戳/额外信息的情况下查看Heroku日志?

时间:2017-03-23 10:14:47

标签: heroku terminal iterm2

当我在iTerm中运行heroku logs时,由于时间戳和额外信息,输出很难读取。有没有办法做到这一点:

2017-03-23T10:05:30.356697+00:00 app[web.1]: D, [2017-03-23T10:05:30.356626 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]   Tenancy Load (1.2ms)  SELECT  "tenancies".* FROM "tenancies" WHERE "tenancies"."id" = $1 LIMIT $2  [["id", 27], ["LIMIT", 1]]
2017-03-23T10:05:30.378627+00:00 app[web.1]: D, [2017-03-23T10:05:30.378565 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]    (1.0ms)  BEGIN
2017-03-23T10:05:30.389814+00:00 app[web.1]: D, [2017-03-23T10:05:30.389755 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]    (1.0ms)  COMMIT
2017-03-23T10:05:30.359482+00:00 app[web.1]: D, [2017-03-23T10:05:30.359409 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]   Tenant Load (1.2ms)  SELECT  "tenants".* FROM "tenants" WHERE "tenants"."id" = $1 LIMIT $2  [["id", 37], ["LIMIT", 1]]
2017-03-23T10:05:30.379631+00:00 app[web.1]: D, [2017-03-23T10:05:30.379572 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]   CACHE (0.0ms)  SELECT  "tenancies".* FROM "tenancies" WHERE "tenancies"."id" = $1 LIMIT $2  [["id", 27], ["LIMIT", 1]]
2017-03-23T10:05:30.391164+00:00 app[web.1]: D, [2017-03-23T10:05:30.391109 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]   CACHE (0.0ms)  SELECT  "tenants".* FROM "tenants" WHERE "tenants"."id" = $1 LIMIT $2  [["id", 37], ["LIMIT", 1]]
2017-03-23T10:05:30.362098+00:00 app[web.1]: D, [2017-03-23T10:05:30.362028 #4] DEBUG -- : [7b1ab640-f23c-49fa-90c9-3cd9baa83c31]   TenancyTenant Load (1.1ms)  SELECT  "tenancy_tenants".* FROM "tenancy_tenants" WHERE "tenancy_tenants"."id" = $1 LIMIT $2  [["id", 14], ["LIMIT", 1]]

看起来像这样:

Tenancy Load (1.2ms)  SELECT  "tenancies".* FROM "tenancies" WHERE "tenancies"."id" = $1 LIMIT $2  [["id", 27], ["LIMIT", 1]]
 (1.0ms)  BEGIN
 (1.0ms)  COMMIT
Tenant Load (1.2ms)  SELECT  "tenants".* FROM "tenants" WHERE "tenants"."id" = $1 LIMIT $2  [["id", 37], ["LIMIT", 1]]
CACHE (0.0ms)  SELECT  "tenancies".* FROM "tenancies" WHERE "tenancies"."id" = $1 LIMIT $2  [["id", 27], ["LIMIT", 1]]
CACHE (0.0ms)  SELECT  "tenants".* FROM "tenants" WHERE "tenants"."id" = $1 LIMIT $2  [["id", 37], ["LIMIT", 1]]
TenancyTenant Load (1.1ms)  SELECT  "tenancy_tenants".* FROM "tenancy_tenants" WHERE "tenancy_tenants"."id" = $1 LIMIT $2  [["id", 14], ["LIMIT", 1]]

由于

1 个答案:

答案 0 :(得分:2)

怎么样:

heroku logs | cut -d "]" -f4