Help us understand the problem. What is going on with this article?

nagios.logのtai64nlocale変換

More than 5 years have passed since last update.

nagios.logは以下のように、ログの時刻formatがtai64nlocaleになってる。
通常はtail64nlocaleコマンドを通せば整形されるが、[]で囲まれてるので正常に変換されない。

nagios.log
[1396426834] Caught SIGHUP, restarting...
[1396426834] Nagios 3.2.0 starting... (PID=8813)
[1396426834] Local time is Wed Apr 02 17:20:34 JST 2014
[1396426834] LOG VERSION: 2.0

なのでperlワンライナーを以下の通りにやって日付を表示させると良い

nagios.log
perl -pe 's/(\d+)/localtime($1)/e' nagios.log

[Wed Apr  2 17:20:34 2014] Caught SIGHUP, restarting...
[Wed Apr  2 17:20:34 2014] Nagios 3.2.0 starting... (PID=8813)
[Wed Apr  2 17:20:34 2014] Local time is Wed Apr 02 17:20:34 JST 2014
[Wed Apr  2 17:20:34 2014] LOG VERSION: 2.0
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away