To create new wiki account, please join us on #znc at freenode and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Difference between revisions of "Log"

From ZNC
Jump to: navigation, search
(less technical with the umask stuff)
m (Use <code> instead of <tt> for the znc-buildmod command.)
 
(12 intermediate revisions by 8 users not shown)
Line 4: Line 4:
 
This module logs your conversations to some special place on your disk.
 
This module logs your conversations to some special place on your disk.
  
Depending on how the log module is loaded, the logs are stored:
+
== '''Notes''' ==
 +
In the znc-0.206 release this module is NOT a core module, see [[ZNC-Extra]] for more information on how to use it
 +
 
 +
Since ZNC 1.2, this module mimics directory permissions set on its data directory (<tt>moddata/log</tt>, in whatever location appropriate to the mode it is running in; see above) when creating new subdirectories. However, as of 2013-08-20, umasks may interfere with it and result in less access being granted than expected. For example, the module may be unable to grant write access to Group or World (umask 0022).
 +
 
 +
To get the directory permission inheritance under ZNC 1.0, use [https://raw.github.com/dgw/znc/log-permissions-1.0-backport/modules/log.cpp this file] and <code>znc-buildmod log.cpp</code>, then move the module to the ZNC modules directory.
  
  global:  ~/.znc/moddata/log/$user_$network_$channel_YYYYMMDD.log
+
== Usage ==
  user:    ~/.znc/users/$user/moddata/log/$network_$channel_YYYYMMDD.log
 
  network: ~/.znc/users/$user/networks/$network/moddata/log/$channel_YYYYMMDD.log
 
  
(Replace ~/.znc/ with your data dir if you use a non-standard one).
+
{{Module arguments
 +
|count=one through three
 +
|extra=<br>This user module takes one through three arguments.
 +
|extra=<br>First argument: <code>-sanitize</code> If presented, removes color codes and [https://en.wikipedia.org/wiki/C0_and_C1_control_codes C0 control codes] from the lines before logged.
 +
<br>Second argument: <code>-timestamp</code> If presented, permits manually specifying a timestamp that will be passed through <code>strftime</code>.
 +
<br>Third argument: Relative path where to store logs. It can contain <code>$USER</code>, <code>$NETWORK</code> and <code>$WINDOW</code> tokens as well as [[Timestamps|time format tokens]].
 +
<br>Depending on the scope in which the log module is loaded, the path argument is relative to the following paths: (Note: <code>~/.znc/</code> might be different if you use a non-standard data directory):
 +
  global:  ~/.znc/moddata/log/
 +
  user:    ~/.znc/users/$USER/moddata/log/
 +
  network: ~/.znc/users/$USER/networks/$NETWORK/moddata/log/
 +
Default paths since 1.6:
 +
  global:  $USER/$NETWORK/$WINDOW/%Y-%m-%d.log
 +
  user:    $NETWORK/$WINDOW/%Y-%m-%d.log
 +
  network: $WINDOW/%Y-%m-%d.log
 +
Default paths prior 1.6:
 +
  global:  $USER_$NETWORK_$WINDOW_%Y%m%d.log
 +
  user:    $NETWORK_$WINDOW_%Y%m%d.log
 +
  network: $WINDOW_%Y%m%d.log
 +
To convert your old logs to the 1.6 format, you can use [https://github.com/ZacharyDuBois/Random-Scripts/blob/master/convert-znc-1.4-logs-to-1.6.sh this user created script].
 +
If you want to log to some other place, make a symlink.
 +
}}
  
You can make a symlink for easier access to that location, e.g.
+
Load the module to start logging, unload it to stop logging. Kinda easy, eh?
ln -s $HOME/.znc/users/dude/moddata/log/ $HOME/dude_irc_logs
 
  
 +
=== Commands ===
  
== '''Notes''' ==
+
; <code>ClearRules</code>
In the znc-0.206 release this module is NOT a core module, see [[ZNC-Extra]] for more information on how to use it
+
: Clear all logging rules
  
In a future ZNC release, this module will mimic directory permissions set on its data directory (<tt>moddata/log</tt>, in whatever location appropriate to the mode it is running in; see above) when creating new subdirectories. However, as of 2013-08-20, umasks may interfere with it and result in less access being granted than expected. For example, the module may be unable to grant write access to Group or World (umask 0022).
+
; <code>Help <search term></code>
 +
: Generate this output. Optionally search for a given word/phrase.
  
== Usage ==
+
; <code>ListRules</code>
 +
: List all logging rules
  
{{Module arguments|count=up to one|one=true|extra=Path where to store logs. It can contain <code>$USER</code>, <code>$NETWORK</code> and <code>$WINDOW</code> substitutes.}}
+
; <code>Set boolean</code> ''(added in 1.7)''
Load the module to start logging, unload it to stop logging. Kinda easy, eh?
+
: Set one of the following booleans: joins, quits, nickchanges.
 +
: For example, <code>/msg *log Set quits false</code> to exclude quit messages from the log.
  
=== Commands ===
+
; <code>SetRules <rules></code>
This module does not support any commands.
+
: Filter chat rooms which should be logged (all by default). Use <code>!#chan</code> or <code>!query</code> to negate and <code>*</code> for wildcards
  
 
== pisg ==
 
== pisg ==
Line 36: Line 62:
  
 
     <channel="#znc">
 
     <channel="#znc">
 +
        # Before ZNC 1.6.0
 
         Logfile = "/home/znc/.znc/users/efnet/moddata/log/#znc_*.log"
 
         Logfile = "/home/znc/.znc/users/efnet/moddata/log/#znc_*.log"
 +
        # Since ZNC 1.6.0
 +
        LogDir="/home/znc/.znc/moddata/log/user/efnet/#znc"
 
         Format = "energymech"
 
         Format = "energymech"
 
         Network = "EFnet"
 
         Network = "EFnet"
 
         OutputFile = "znc.html"
 
         OutputFile = "znc.html"
 
     </channel>
 
     </channel>

Latest revision as of 21:29, 19 May 2017


This module logs your conversations to some special place on your disk.

Notes[edit]

In the znc-0.206 release this module is NOT a core module, see ZNC-Extra for more information on how to use it

Since ZNC 1.2, this module mimics directory permissions set on its data directory (moddata/log, in whatever location appropriate to the mode it is running in; see above) when creating new subdirectories. However, as of 2013-08-20, umasks may interfere with it and result in less access being granted than expected. For example, the module may be unable to grant write access to Group or World (umask 0022).

To get the directory permission inheritance under ZNC 1.0, use this file and znc-buildmod log.cpp, then move the module to the ZNC modules directory.

Usage[edit]

Arguments

This user module takes one through three arguments.
First argument: -sanitize If presented, removes color codes and C0 control codes from the lines before logged.
Second argument: -timestamp If presented, permits manually specifying a timestamp that will be passed through strftime.
Third argument: Relative path where to store logs. It can contain $USER, $NETWORK and $WINDOW tokens as well as time format tokens.
Depending on the scope in which the log module is loaded, the path argument is relative to the following paths: (Note: ~/.znc/ might be different if you use a non-standard data directory):

 global:  ~/.znc/moddata/log/
 user:    ~/.znc/users/$USER/moddata/log/
 network: ~/.znc/users/$USER/networks/$NETWORK/moddata/log/

Default paths since 1.6:

 global:  $USER/$NETWORK/$WINDOW/%Y-%m-%d.log
 user:    $NETWORK/$WINDOW/%Y-%m-%d.log
 network: $WINDOW/%Y-%m-%d.log

Default paths prior 1.6:

 global:  $USER_$NETWORK_$WINDOW_%Y%m%d.log
 user:    $NETWORK_$WINDOW_%Y%m%d.log
 network: $WINDOW_%Y%m%d.log

To convert your old logs to the 1.6 format, you can use this user created script. If you want to log to some other place, make a symlink.

Read loading modules to learn more about loading modules.

Load the module to start logging, unload it to stop logging. Kinda easy, eh?

Commands[edit]

ClearRules
Clear all logging rules
Help <search term>
Generate this output. Optionally search for a given word/phrase.
ListRules
List all logging rules
Set boolean (added in 1.7)
Set one of the following booleans: joins, quits, nickchanges.
For example, /msg *log Set quits false to exclude quit messages from the log.
SetRules <rules>
Filter chat rooms which should be logged (all by default). Use !#chan or !query to negate and * for wildcards

pisg[edit]

The log module uses the "energymech" format so it can be used with pisg if so desired.

Example Config[edit]

   <channel="#znc">
       # Before ZNC 1.6.0
       Logfile = "/home/znc/.znc/users/efnet/moddata/log/#znc_*.log"
       # Since ZNC 1.6.0
       LogDir="/home/znc/.znc/moddata/log/user/efnet/#znc"
       Format = "energymech"
       Network = "EFnet"
       OutputFile = "znc.html"
   </channel>