Okay... i made a simple tes like this.

counter error_messages_in_log
counter warn_messages_in_log
counter total_messages_in_log

# To make ex_test.go happy
#strptime("2017-12-07T16:07:14Z", "2006-01-02T15:04:05Z07:00")

/(.*)/ {
  $1 =~ /ERROR/ {
    error_messages_in_log++
  }
  $1 =~ /WARN/ {
    warn_messages_in_log++
  }
  total_messages_in_log++
}

and it counts ERROR and WARN in a file and puts metrics up.
It does this for 1 file, how can i monitor multiple files like this?
Can i incorperate filenames?

Op donderdag 24 september 2020 om 12:57:45 UTC+2 schreef Danny de Waard:

> I did look at grok but it was soo complex looking.
> I'm now looking at mtail but my first question is, can i monitor multiple 
> files with multiple rules in one mtail
>
> for instacne i want to count [WARN ] and [ERROR] tags in 5 different 
> logfiles and metric output has to be seperated like that
>
> So
> {LogA_ERROR_Metric} nn
> {LogA_WARN_Metric} nn
>
> {LogB_ERROR_Metric} nn
> {LogB_WARN_Metric} nn
>
> {LogC_ERROR_Metric} nn
> {LogC_WARN_Metric} nn
>
> Op donderdag 24 september 2020 om 11:32:09 UTC+2 schreef Stuart Clark:
>
>> On 2020-09-24 10:27, Danny de Waard wrote:
>> > Hi All,
>> > 
>> > I am looking for a good way to search and count for texts in logfiles.
>> > For instance i want to count ERROR, WARN, INFO words in a logfile
>> > But also i want to be able to count all the different response codes
>> > of a acces or ssl-request logfile.
>> > So how many 200, 304, 404 and so on and maybe also sum the transfered
>> > bits as an average.
>> > 
>> > I now have a perl script that does a count based on regex and does
>> > this every minute but im really looking for a exporter that can do
>> > this and publish it like for instance node_exporter.
>> > 
>> > Is there any exporter that can do this in a siple way?
>>
>> This sounds like a good fit for mtail or the grok exporter:
>>
>> https://github.com/google/mtail
>> https://github.com/fstab/grok_exporter
>>
>> -- 
>> Stuart Clark
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/b2dde872-d76c-47e8-88e6-96732c285ab2n%40googlegroups.com.

Reply via email to