<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  
  
  <link rel="shortcut icon" href="img/favicon.ico">
  <title>logex - logfmt1</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700" />

  <link rel="stylesheet" href="css/theme.css" />
  <link rel="stylesheet" href="css/theme_extra.css" />
  <link href="custom.css" rel="stylesheet" />
  <link href="syntax.css" rel="stylesheet" />
  
  <script>
    // Current page data
    var mkdocs_page_name = "logex";
    var mkdocs_page_input_path = "logex.md";
    var mkdocs_page_url = null;
  </script>
  
  <script src="js/jquery-2.1.1.min.js" defer></script>
  <script src="js/modernizr-2.8.3.min.js" defer></script> 
  
</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
    <div class="wy-side-scroll">
      <div class="wy-side-nav-search">
        <a href="." class="icon icon-home"> logfmt1</a>
        
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="index.html">Intro</a>
                    </li>
                </ul>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="log.fmt.html">.log.fmt</a>
                    </li>
                </ul>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="logopen.html">logopen()</a>
                    </li>
                </ul>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="regex.html">regex()</a>
                    </li>
                </ul>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="fmt.html">global .fmt db</a>
                    </li>
                </ul>
                <ul>
                    <li class="toctree-l1"><a class="reference internal" href="update-logfmt.html">update-logfmt</a>
                    </li>
                </ul>
                <ul class="current">
                    <li class="toctree-l1 current"><a class="reference internal current" href="logex.html">logex</a>
    <ul class="current">
    </ul>
                    </li>
                </ul>
      </div>
    </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href=".">logfmt1</a>
      </nav>

      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href=".">Docs</a> &raquo;</li>
    
      
    
    <li>logex</li>
    <li class="wy-breadcrumbs-aside">
      
    </li>
  </ul>
  
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
                <h3 id="logex">logex</h3>
<p><code>logex</code> is a little command line tool around <a href="logopen.html"><code>logopen()</code></a>.
It basically allows fetching individual fields from a log, and/or
restructuring it into a specific format (e.g. tab or comma-delimited).</p>
<div class="codehilite"><pre><span></span><code><span class="err">logex access.log @request_uri @datetime @user_agent</span>
</code></pre></div>

<p>Where the first param is always the log file, and then an arbitrary
number of field names - either individually or as part of a string
argument:</p>
<div class="codehilite"><pre><span></span><code><span class="err">logex access.log --tab &quot;uri,date,status&quot; user_agent</span>
</code></pre></div>

<p>(Would delimit the first three per comma, the last with a tab.)</p>
<h2 id="flags">Flags</h2>
<table>
<thead>
<tr>
<th>param</th>
<th>desc</th>
</tr>
</thead>
<tbody>
<tr>
<td>--json</td>
<td>output each row as JSON</td>
</tr>
<tr>
<td>--csv</td>
<td>join all fields with comma</td>
</tr>
<tr>
<td>--tab</td>
<td>tab-separated output</td>
</tr>
<tr>
<td>--iso8601</td>
<td>fix any datetime fields</td>
</tr>
<tr>
<td>--regex</td>
<td>just output regex for log</td>
</tr>
<tr>
<td>--debug</td>
<td>debug_rx in case the regex fails</td>
</tr>
</tbody>
</table>
<h2 id="pefixes">Pefixes</h2>
<p>The argument list allows field name prefixes.  Which are only relevant to
container-fields (expanded key:value pairs for some application formats), in
case they're holding lists.</p>
<table>
<thead>
<tr>
<th>prefix</th>
<th>output</th>
</tr>
</thead>
<tbody>
<tr>
<td>@name</td>
<td>will just show the first entry</td>
</tr>
<tr>
<td>%name</td>
<td>space-separated list</td>
</tr>
<tr>
<td>*name</td>
<td>comma-separated list</td>
</tr>
<tr>
<td>+name</td>
<td>plus-joined list</td>
</tr>
<tr>
<td>#name</td>
<td>as json array</td>
</tr>
<tr>
<td>name</td>
<td>whatever</td>
</tr>
</tbody>
</table>
              
            </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="update-logfmt.html" class="btn btn-neutral" title="update-logfmt"><span class="icon icon-circle-arrow-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
    
  </div>

  Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
      
        </div>
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" aria-label="versions">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
      
        <span><a href="update-logfmt.html" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
    </span>
</div>
    <script>var base_url = '.';</script>
    <script src="js/theme.js" defer></script>
    <script defer>
        window.onload = function () {
            SphinxRtdTheme.Navigation.enable(true);
        };
    </script>

</body>
</html>
