1 <html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Persistant Storage</title><link href="modsecurity-reference.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.69.1" name="generator"><link rel="start" href="index.html" title="ModSecurity® Reference
2 Manual"><link rel="up" href="index.html" title="ModSecurity® Reference
3 Manual"><link rel="prev" href="ar01s10.html" title="Macro Expansion"><link rel="next" href="ar01s12.html" title="Miscellaneous Topics"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div style="background:#F5F5F5;width:100%;border-top:1px solid #DDDDDD;border-bottom:1px solid #DDDDDD"><table width="100%" cellspacing="0" cellpadding="0"><tr><td><a href="http://www.modsecurity.org"><img style="margin:4px" src="modsecurity.gif" width="120" height="36" alt="ModSecurity" border="0"></a></td><td align="right"><a href="http://www.breach.com"><img style="margin:6px" src="breach-logo-small.gif" height="36" width="100" border="0"></a></td></tr></table></div><div id="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Persistant Storage</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="ar01s10.html">Prev</a> </td><td align="center" width="60%"> <a accesskey="h" href="index.html">Home</a></td><td align="right" width="20%"> <a accesskey="n" href="ar01s12.html">Next</a></td></tr></table><hr size="1"></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="N11DFF"></a>Persistant Storage</h2></div></div><div></div></div><p>At this time it is only possible to have three collections in which
4 data is stored persistantly (i.e. data available to multiple requests).
5 These are: <code class="literal">IP</code>, <code class="literal"> SESSION</code> and <code class="literal">USER</code>.</p><p>Every collection contains several built-in variables that are
6 available and are read-only unless otherwise specified:</p><div class="orderedlist"><ol type="1"><li><p><code class="literal">CREATE_TIME</code> - date/time of
7 the creation of the collection.</p></li><li><p><code class="literal">IS_NEW</code> - set to 1 if the
8 collection is new (not yet persisted) otherwise set to 0.</p></li><li><p><code class="literal">KEY</code> - the value of the
9 initcol variable (the client's IP address in the example).</p></li><li><p><code class="literal">LAST_UPDATE_TIME</code> - date/time
10 of the last update to the collection.</p></li><li><p><code class="literal">TIMEOUT</code> - date/time in
11 seconds when the collection will be updated on disk from memory (if no
12 other updates occur). This variable may be set if you wish to specifiy
13 an explicit expiration time (default is 3600 seconds).</p></li><li><p><code class="literal">UPDATE_COUNTER</code> - how many
14 times the collection has been updated since creation.</p></li><li><p><code class="literal">UPDATE_RATE</code> - is the average
15 rate updates per minute since creation.</p></li></ol></div><p>To create a collection to hold session variables (<code class="literal">SESSION</code>) use action <code class="literal">setsid</code>. To create a collection to hold user
16 variables (<code class="literal">USER</code>) use action <code class="literal">setuid</code>. To create a collection to hold client
17 address variables (<code class="literal">IP</code>) use action
18 <code class="literal">initcol</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>ModSecurity implements atomic updates of persistent variables only
19 for integer variables (counters) at this time. Variables are read from
20 storage whenever <code class="literal">initcol</code> is encountered in the rules
21 and persisted at the end of request processing. Counters are adjusted by
22 applying a delta generated by re-reading the persisted data just before
23 being persisted. This keeps counter data consistent even if the counter
24 was modified and persisted by another thread/process during the
25 transaction.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>ModSecurity uses a Berkley Database (SDBM) for persistant storage.
26 This type of database is generally limited to storing a maximum of 1008
27 bytes per key. This may be a limitation if you are attempting to store a
28 considerable amount of data in variables for a single key. Some of this
29 limitation is planned to be reduced in a future version of
30 ModSecurity.</p></div></div><div id="navfooter"><hr size="1"><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ar01s10.html">Prev</a> </td><td align="center" width="20%"> </td><td align="right" width="40%"> <a accesskey="n" href="ar01s12.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">Macro Expansion </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> Miscellaneous Topics</td></tr></table></div><div align="center" class="copyright">Copyright (C) 2004-2009 <a href="http://www.breach.com">Breach Security</a></div></body></html>