Examples: Configuration of the connector using the "monitoringParams" - TeamViewer Support
<main>
<article class="userContent">
<p><br></p><p>The following examples describe use cases and their respective configuration of the <strong>Log Parser Connector</strong> as specified by the <strong>monitoringParams </strong>parameter.</p><p><br></p><h3></h3><h2 data-id="example-1">Example 1</h2><p>Parse a log file to retrieve the <strong>maximum value</strong> of a metric called <code class="code codeInline" spellcheck="false" tabindex="0">temperature</code> and the average value of a metric called <code class="code codeInline" spellcheck="false" tabindex="0">humidity</code>.</p><pre class="code codeBlock" spellcheck="false" tabindex="0">>> Log File (log_file.log) Contents:
some text temperature=18 some text humidity=80
some other text temperature=19 some text humidity=82 text
>> monitoringParams:
--file log_file.log --parser metrics --metrics temperature humidity --aggfunctions max avg --template=":metric=(.*?)[\s]"
>> Result:
{"temperature": 19, "humidity":81}
</pre><p><br></p><h3 data-id="-1"></h3><h2 data-id="example-2">Example 2</h2><p>Parse a log file to retrieve the number of occurrences of the string <code class="code codeInline" spellcheck="false" tabindex="0">findMe</code>.</p><pre class="code codeBlock" spellcheck="false" tabindex="0">>> Log File (log_file.log) Contents:
some text findMe some text findMe
some other text temperature=19 some findMe text humidity=82 text
>> monitoringParams:
--file log_file.log --parser matches --regex someRegex
>> Result:
{"count": 3}
</pre><p><br></p><h3 data-id="-2"></h3>
</article>
</main>