It is currently Wed Sep 18, 2019 1:14 pm
All times are UTC + 8 hours

[HOW TO] Write system/connect/file log for your applications

Share your awesome tips and tricks here.

[HOW TO] Write system/connect/file log for your applications

Postby James.W@AST » Fri Apr 12, 2013 11:12 am

You may use the built-in utility to write your own logs in [System Information] -> [Log], and it's located at "/usr/builtin/syslog"

You can see the details about this utility by executing it:
Code: Select all
root@AS-606T:/ # /usr/sbin/syslog
Syslog. Ver. 0.1.0
Copyright (C) 2012 Asustor Systems, Inc.  All Rights Reserved.

Usage: /usr/sbin/syslog options
  -h --help             Display this usage information.
  -q --quiet            Be quiet.
  -g --log <type>       Type of log (0: System, 1: Connection, 2: File Access, 3: Boot Up)
  -l --level <type>     Type of level (0: INFO, 1: WARNING, 2: ERROR, 3: CRITICAL)
  -t --time <datetime>  Date and time format YYYY-MM-DD HH:mm:ss (2012-03-15 09:13:38)
  -u --user <name>      User name
  -e --event <msg>      Event message
  -f --from <address>   Log from which host ip address
  -c --computer <name>  Log from which computer name
  -p --protocol <name>  Connection/File Access protocol (service)
  -i --action <type>    Connection action (0: Sign in, 1: Sign out, 2: Sign in failed)
  -a --access <type>    File access type (0: Read, 1: Write, 2: Delete, 3: Create, 4: Create Folder, 5: Delete Folder, 6: Rename, 7: Move/Copy )
  -s --source <path>    File access file full path


And here are some examples about how to write different type of logs (System, Connection and File Access):

System log:
Code: Select all
/usr/sbin/syslog --log 0 --level 0 --user admin --event "System started"

Connection log:
Code: Select all
/usr/sbin/syslog -g 1 -l 1 -u admin -f 192.168.0.1 -c User-PC -p SAMBA -i 2

File access log:
Code: Select all
/usr/sbin/syslog -g 2 -l 1 -u admin -f 192.168.1.10 -p FTP -a 2 -s "/volume1/Public/file.txt"
To Infinity and Beyond!

Friends of My AS-606T: (RAID 5 with WD Black 2TB * 4, WD Red 2TB * 2)
MacBook Air (10.8) & Self-assembled Windows PC (Windows 7)
iPhone 4S (iOS 6) & iPad 2 (iOS 6)
Boxee Box, Logitech Squeezebox Duet
SONY HT-CT150 Sound Bar (Connected directly to the NAS via HDMI)
CISCO Linksys E4200
User avatar
James.W@AST
 
Posts: 189
Joined: Wed Jun 06, 2012 12:50 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby ho66es » Fri Apr 12, 2013 4:06 pm

many thanks, working nicely here.
608t
ho66es
 
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby pataranda » Tue Feb 04, 2014 11:25 pm

hello, I tried to do this on the 302 but I did not create the file. I have to enable something first? what it means to use the built-in utility?

thank you very much
pataranda
 
Posts: 13
Joined: Sat Nov 23, 2013 12:32 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby ho66es » Wed Feb 05, 2014 12:46 am

pataranda wrote:hello, I tried to do this on the 302 but I did not create the file. I have to enable something first? what it means to use the built-in utility?

thank you very much


the built in utility referred to is 'syslog' located in /usr/sbin
608t
ho66es
 
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby pataranda » Wed Feb 05, 2014 1:44 am

But you can create a text file that automatically exports the report I access?

thank you very much
pataranda
 
Posts: 13
Joined: Sat Nov 23, 2013 12:32 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby ho66es » Wed Feb 05, 2014 1:53 am

pataranda wrote:But you can create a text file that automatically exports the report I access?

thank you very much


sorry I am not sure I understand exactly what you are trying to do, I use the util to write information to the system log from a batch file I use to backup my mysql databases

Capture.PNG
Capture.PNG (15.31 KiB) Viewed 10071 times


explained with exaples in this thread viewtopic.php?f=49&t=1728
608t
ho66es
 
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby pataranda » Wed Feb 05, 2014 2:24 am

I have to export the syslog file access, is it possible?
pataranda
 
Posts: 13
Joined: Sat Nov 23, 2013 12:32 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby ho66es » Wed Feb 05, 2014 3:16 am

pataranda wrote:I have to export the syslog file access, is it possible?


they are created in an accessible folder so the simple answer is yes, you should be able to access them with file explorer or do you require something else?

just checked, its not easy from file explorer, I use winscp and with it there are no problems accessing logs.
608t
ho66es
 
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby pataranda » Thu Feb 06, 2014 9:21 am

but what is the folder where I can find them?
thank you very much
pataranda
 
Posts: 13
Joined: Sat Nov 23, 2013 12:32 am

Re: [HOW TO] Write system/connect/file log for your applicat

Postby ho66es » Thu Feb 06, 2014 3:02 pm

Not at home right now think it's /var/logs

Sent from my Nexus 5 using Tapatalk
608t
ho66es
 
Posts: 476
Joined: Wed Mar 13, 2013 5:38 am

Next

Return to Tips & Tricks

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 1 guest