log2ndo utility errors after converting julian to date
Posted: Tue Jun 05, 2012 1:28 pm
I have converted 2 years of log files from julian to date with the following shell script
#!/bin/bash
FILES=/usr/local/nagios/var/archives/*.log
for f in $FILES
do
#echo "$f"
if [ "$f" = "/usr/local/nagios/var/archives/*.log" ]; then
break;
fi
cat $f | while read date rest ; do timestamp=$(echo $date | sed 's/\[//;s/\]//'); echo $(date -d @$timestamp) $rest ; done > $f"T" ; rm $f
done
So How can I load this data into mysql using log to ndo? It seems to error out on the converted date as it probably expects a julian.
is there a argument switch. Looking for events with julian was impossible so I fond this script to convert to real date time.
format is :
Tue Oct 25 00:00:00 PDT 2011 CURRENT HOST STATE: affinity_node_a;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.34 ms
or as a worst case is there a sed command to reverse as I did not keep original logs (Whoops)
#!/bin/bash
FILES=/usr/local/nagios/var/archives/*.log
for f in $FILES
do
#echo "$f"
if [ "$f" = "/usr/local/nagios/var/archives/*.log" ]; then
break;
fi
cat $f | while read date rest ; do timestamp=$(echo $date | sed 's/\[//;s/\]//'); echo $(date -d @$timestamp) $rest ; done > $f"T" ; rm $f
done
So How can I load this data into mysql using log to ndo? It seems to error out on the converted date as it probably expects a julian.
is there a argument switch. Looking for events with julian was impossible so I fond this script to convert to real date time.
format is :
Tue Oct 25 00:00:00 PDT 2011 CURRENT HOST STATE: affinity_node_a;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.34 ms
or as a worst case is there a sed command to reverse as I did not keep original logs (Whoops)