freenas.local security run output

Status
Not open for further replies.

blubberor

Dabbler
Joined
Jan 31, 2016
Messages
40
Hi,
I am getting the security output automatically via mail every day.
Is there a way to include time and date to every line?
My internet connection is constantly lost. with the log files I could specifically track times and get back to the provider.
Code:
freenas.local kernel log messages:

re0: link state changed to DOWN
re0: link state changed to UP
.
.
.

-- End of security output --



Best and thanks,
blubberor
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
Is there a way to include time and date to every line?
No

My internet connection is constantly lost.
You will have to find another means to handle this.

I had an ISP issue many years ago, they were having speed issues. I created a script which ran every 10 minutes to check the upload speed of my connection and then record the results. If the results were below a certain threshold the script would generate a log letting me know all the info I needed, including data from my Cable Modem because I was trying to figure out if it was a signal quality issue or just a drop in service.

I presented my data a few months later and they discovered a bad component in the equipment servicing my neighborhood. Intermittent problems are at times difficult to isolate so I couldn't blame the ISP because I needed to prove it wasn't my cable modem (one I purchased myself).

EDIT: Since this is not a FreeNAS issue, moving to Off Topic thread.
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
My internet connection is constantly lost. with the log files I could specifically track times and get back to the provider.

Is your FreeNAS box connected to the internet via a router? If so, you might be able to see connection losses (eventually with a time stamp) in the web interface of that device.

Code:
freenas.local kernel log messages:

re0: link state changed to DOWN
re0: link state changed to UP

But this might very well be caused by the hardware in your FreeNAS box (or the FreeBSD drivers for it).
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
EDIT: Since this is not a FreeNAS issue, moving to Off Topic thread.
How is this not a FreeNAS issue? The question is whether it's possible to change the security run output to include the date and time of events noted. That's a FreeNAS question. OP is also correct that his hardware has nothing to do with it.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
How is this not a FreeNAS issue? The question is whether it's possible to change the security run output to include the date and time of events noted. That's a FreeNAS question. OP is also correct that his hardware has nothing to do with it.
Unless the Realtek is crapping out every day, which is quite likely. The log is at best tangentially related to whatever might be going on with the internet connection.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
The log is at best tangentially related to whatever might be going on with the internet connection.
Agreed, but that isn't his question. This is his question:
Is there a way to include time and date to every line?
@joeschmuck says the answer is no, and to the best of my knowledge, he's right, but that doesn't change what the question is.

OP is hoping to use that log information to fight with his ISP, which may or may not be productive (for the reasons you've mentioned), but his question (which is pretty simple) is directly related to FreeNAS.
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
A bit of additional information for the OP: While a time stamp in the security run output mail would be useful at times I don't consider it vital as this information can be obtained by looking at the proper log file.

For example after pulling and reinserting the ethernet plug on my NAS:
Code:
[root@blunzn] ~# grep igb0 /var/log/messages
Sep 17 22:31:38 blunzn kernel: igb0: link state changed to DOWN
Sep 17 22:31:38 blunzn kernel: igb0: link state changed to DOWN
Sep 17 22:31:48 blunzn devd: Executing '/etc/rc.d/dhclient quietstart igb0'
Sep 17 22:31:48 blunzn kernel: igb0: link state changed to UP
Sep 17 22:31:48 blunzn kernel: igb0: link state changed to UP
Sep 17 22:31:51 blunzn dhclient: New IP Address (igb0): 192.168.178.80
Sep 17 22:31:51 blunzn dhclient: New Subnet Mask (igb0): 255.255.255.0
Sep 17 22:31:51 blunzn dhclient: New Broadcast Address (igb0): 192.168.178.255
Sep 17 22:31:51 blunzn dhclient: New Routers (igb0): 192.168.178.1
 

blubberor

Dabbler
Joined
Jan 31, 2016
Messages
40
Thank you very much, all.
did not want to be impolite but hardware in this situation did not change anything, as there is no additional logging server. therefore happy to get assistance.

@MrToddsFriends this command helped a lot!! is there a unix command that I can call once daily to send me a mail with the log file?
for me it was (not logged in as root) sudo grep re0 /var/log/messages

Best and thanks,
Blubberor
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
How is this not a FreeNAS issue? The question is whether it's possible to change the security run output to include the date and time of events noted. That's a FreeNAS question. OP is also correct that his hardware has nothing to do with it.
I can see your point however the OP was looking to troubleshoot a problem not related to FreeNAS. In my opinion this should still be in the Off Topic threads.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
is there a unix command that I can call once daily to send me a mail with the log file?
Yes. It's not unix, it's FreeBSD even though the commands are all similar.
You can create a CRON job to run once a day to create the file and email it to yourself. I don't have the usage off the top of my head but will provide something shortly.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
So the command would be something like this, name the file emailme.sh (you should read the FreeBSD sendmail command). To run it from the command line is: sh emailme.sh
Code:
#!/usr/local/bin/sh
#
# Place this in /conf/base/etc/
# Call: sh emailme.sh
(
echo "To: youremail.address.com"
echo "Subject: Results"
echo "MIME-Version: 1.0"
echo "Content-Type: text"
echo " "
) > /var/cover1.txt
grep re0 /var/log/messages >> /var/cover1.txt
(
echo "---------------END--END--END--END--END--END-----------------"
echo " "
sendmail -t < /var/cover1.txt
exit 0

Test this out, you just need to change the email address and it should work. Once done then add it as a CRON job via the FreeNAS GUI.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,996
Status
Not open for further replies.
Top