Ad Widget

Collapse

Add Timestamp to a log value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kris
    Junior Member
    • Jul 2020
    • 4

    #1

    Add Timestamp to a log value

    Hallo and thank you in advance,

    we use Zabbix to monitor a bunch of Logfiles via agent(active) and logrt these values are then displayed in a Grafana dashboard.
    Unfortunately, some of the logs do not have a timestamp in front of the extracted value. Instead the Date and Time is in a different row or non-existend


    for example:
    ------------------------------------------------------------------
    1142 kopiert (109,5GB -> 109,5GB), 1 verschoben, 226 gelöscht
    finished 18:16:19 29.07.2020

    ------------------------------------------------------------------

    Is there a possibility to add the timestamp at the beginning of the value via preprocessing?

    Click image for larger version

Name:	zabbix.jpg
Views:	495
Size:	16.5 KB
ID:	406137
  • Kris
    Junior Member
    • Jul 2020
    • 4

    #2
    Is there some way to do this? Do I need to provide more information?

    Comment

    • Kris
      Junior Member
      • Jul 2020
      • 4

      #3
      I guess the best way is using JavaScript in Preprocessing:


      Code:
      function(value){
        var today = new Date();
        var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
        var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
        var dateTime = date+' '+time
        return dateTime+' '+value
      
      }

      Comment

      Working...