0

I'm running neo4j in a CoreOS unit as a docker container.

The logs coming from neo4j contain timestamps, but the journal system in CoreOS also has its own timestamps. I'd like to remove the timestamps from the neo4j logs and just let the journal system take care of that for me.

(BONUS: the neo4j logs are a bit inconsistent, is there a way to get them to put the category and level indicators in the same place?)

Here is an example of what I get now:

Feb 01 17:15:26 core-brix docker[4726]: 2015-02-01 17:15:26.167+0000 INFO  [API] Mounting static content at [/webadmin] from [webadmin-html]
Feb 01 17:15:26 core-brix docker[4726]: 2015-02-01 17:15:26.203+0000 INFO  [API] Mounting static content at [/browser] from [browser]
Feb 01 17:15:26 core-brix docker[4726]: 17:15:26.205 [main] WARN  o.e.j.server.handler.ContextHandler - o.e.j.s.ServletContextHandler@51dd475f{/,null,null} contextPath ends with /
Feb 01 17:15:26 core-brix docker[4726]: 17:15:26.205 [main] WARN  o.e.j.server.handler.ContextHandler - Empty contextPath

And this is a hand-crafted example of what I'd love to be getting:

Feb 01 17:15:26 core-brix docker[4726]: INFO [API] Mounting static content at [/webadmin] from [webadmin-html]
Feb 01 17:15:26 core-brix docker[4726]: INFO [API] Mounting static content at [/browser] from [browser]
Feb 01 17:15:26 core-brix docker[4726]: WARN [main] o.e.j.server.handler.ContextHandler - o.e.j.s.ServletContextHandler@51dd475f{/,null,null} contextPath ends with /
Feb 01 17:15:26 core-brix docker[4726]: WARN [main] o.e.j.server.handler.ContextHandler - Empty contextPath

I think that this is mostly a neo4j question, but perhaps there is some systemd/coreos magic that could help as well.

brendanjerwin
  • 132
  • 4
  • 5

1 Answers1

1

There are a number of utilities that can be used to do this but cut is probably the easiest one to use here.

You can use

  • The -d switch to specify a different delimiter character.
  • The -f switch to select the fields you want to keep.
user9517
  • 115,471
  • 20
  • 215
  • 297
  • I had given `sed` a try, but found that it was holding on to the output until the thing was stopped... (It worked fairly well when testing in the console, but once it was in the docker container and running as a systemd unit the behavior changed.) – brendanjerwin Feb 01 '15 at 17:52