J
J
juffinhalli2013-04-30 14:44:05
linux
juffinhalli, 2013-04-30 14:44:05

Building a graph from syslog using regular expressions?

Good afternoon, hackers!
Given:
Debian server,
utility that dumps device temperature in syslog Log
entries look like this:
Apr 30 14:28:41 user montbc[22304]: DEV0 62.0C 500RPM
Apr 30 14:28:42 user montbc[22304]: DEV0 63.0C 500RPM
Apr 30 14:28:43 user montbc[22304]: DEV0 63.0C 500RPM
Apr 30 14:28:44 user montbc[22304]: DEV0 61.0C 500RPM
Task to plot device temperature
Thanks in advance for your help.
Update: The RPM also changes, but we don't need it.
PS In collectd, the task should be solved using the tail plugin, but there you need to know regular expressions. And I have trouble with them.
I watched the official guideaccording to the tail plugin, but alas, I did not find an explicit example for my task.
My variant below does not give any data to the plot at all 8(. Other plots are formed successfully (sensors, df, etc.)
GNU nano 2.2.6 File: /etc/collectd/collectd.conf
LoadPlugin tail
<Plugin "tail">
<File "/var/log/syslog">
Instance "Temperature"
Regex "DEV0 (\d+).0C"
DSType "GaugeLast"
Type "gauge"
Instance "tbc"
UPDATE
Solution turned out to be simple
LoadPlugin tail
<Plugin "tail">
< File "/var/log/syslog">
Instance "Temperature"
Regex ": DEV0 ([0-9]+).0C"
DSType "GaugeLast"
Type "temperature"
Instance "DEV0"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TeiSinTai, 2013-04-30
@TeiSinTai

Or maybe try this:

<Plugin "tail">
  <File "/var/log/syslog">
    Instance "Temperature"
    <Match>
      Regex "DEV0\S+(\d+)\.0C"
      DSType "GaugeLast"
      Type "gauge"
      Instance "tbc"
    </Match>
  </File>
</Plugin>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question