summaryrefslogtreecommitdiffstats
path: root/logsmanagement/rrd_api/rrd_api_web_log.c
blob: 5ab6020443d34442666586ab1b879b6836fb54a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
// SPDX-License-Identifier: GPL-3.0-or-later

#include "rrd_api_web_log.h"

void web_log_chart_init(struct File_info *p_file_info){
    p_file_info->chart_meta->chart_data_web_log = callocz(1, sizeof (struct Chart_data_web_log));
    chart_data_web_log_t *chart_data = p_file_info->chart_meta->chart_data_web_log;
    chart_data->last_update = now_realtime_sec(); // initial value shouldn't be 0
    long chart_prio = p_file_info->chart_meta->base_prio;

    lgs_mng_do_num_of_logs_charts_init(p_file_info, chart_prio);

    /* Vhost - initialise */
    if(p_file_info->parser_config->chart_config & CHART_VHOST){
        chart_data->cs_vhosts = lgs_mng_create_chart(
            (char *) p_file_info->chartname    // type
            , "vhost"                           // id
            , "Requests by Vhost"               // title
            , "requests"                        // units
            , "vhost"                           // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );
    }

    /* Port - initialise */
    if(p_file_info->parser_config->chart_config & CHART_PORT){
        chart_data->cs_ports = lgs_mng_create_chart(
            (char *) p_file_info->chartname    // type
            , "port"                            // id
            , "Requests by Port"                // title
            , "requests"                        // units
            , "port"                            // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );
    }

    /* IP Version - initialise */
    if(p_file_info->parser_config->chart_config & CHART_IP_VERSION){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname    // type
            , "ip_version"                      // id
            , "Requests by IP version"          // title
            , "requests"                        // units
            , "ip_version"                      // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("ipv4", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("ipv6", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("invalid", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* Request client current poll - initialise */
    if(p_file_info->parser_config->chart_config & CHART_REQ_CLIENT_CURRENT){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname    // type
            , "clients"                         // id
            , "Current Poll Unique Client IPs"  // title
            , "unique ips"                      // units
            , "clients"                         // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("ipv4", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("ipv6", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* Request client all-time - initialise */
    if(p_file_info->parser_config->chart_config & CHART_REQ_CLIENT_ALL_TIME){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname    // type
            , "clients_all"                     // id
            , "All Time Unique Client IPs"      // title
            , "unique ips"                      // units
            , "clients"                         // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("ipv4", RRD_ALGORITHM_ABSOLUTE_NAME, 1, 1);
        lgs_mng_add_dim("ipv6", RRD_ALGORITHM_ABSOLUTE_NAME, 1, 1);
    }

    /* Request methods - initialise */
    if(p_file_info->parser_config->chart_config & CHART_REQ_METHODS){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "http_methods"                    // id
            , "Requests Per HTTP Method"        // title
            , "requests"                        // units
            , "http_methods"                    // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        for(int j = 0; j < REQ_METHOD_ARR_SIZE; j++)
            lgs_mng_add_dim(req_method_str[j], RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* Request protocol - initialise */
    if(p_file_info->parser_config->chart_config & CHART_REQ_PROTO){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "http_versions"                   // id
            , "Requests Per HTTP Version"       // title
            , "requests"                        // units
            , "http_versions"                   // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("1.0", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("1.1", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("2.0", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("other", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* Request bandwidth - initialise */
    if(p_file_info->parser_config->chart_config & CHART_BANDWIDTH){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "bandwidth"                       // id
            , "Bandwidth"                       // title
            , "kilobits"                        // units
            , "bandwidth"                       // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("received", RRD_ALGORITHM_INCREMENTAL_NAME, 8, 1000);
        lgs_mng_add_dim("sent", RRD_ALGORITHM_INCREMENTAL_NAME, -8, 1000);
    }

    /* Request processing time - initialise */
    if(p_file_info->parser_config->chart_config & CHART_REQ_PROC_TIME){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "timings"                         // id
            , "Request Processing Time"         // title
            , "milliseconds"                    // units
            , "timings"                         // family
            , NULL                              // context
            , RRDSET_TYPE_LINE_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("min", RRD_ALGORITHM_ABSOLUTE_NAME, 1, 1000);
        lgs_mng_add_dim("max", RRD_ALGORITHM_ABSOLUTE_NAME, 1, 1000);
        lgs_mng_add_dim("avg", RRD_ALGORITHM_ABSOLUTE_NAME, 1, 1000);
    }

    /* Response code family - initialise */
    if(p_file_info->parser_config->chart_config & CHART_RESP_CODE_FAMILY){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "responses"                       // id
            , "Response Codes"                  // title
            , "requests"                        // units
            , "responses"                       // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("1xx", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("2xx", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("3xx", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("4xx", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("5xx", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("other", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }   

    /* Response code - initialise */
    if(p_file_info->parser_config->chart_config & CHART_RESP_CODE){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "detailed_responses"              // id
            , "Detailed Response Codes"         // title
            , "requests"                        // units
            , "responses"                       // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        for(int idx = 0; idx < RESP_CODE_ARR_SIZE - 1; idx++){
            char dim_name[4];
            snprintfz(dim_name, 4, "%d", idx + 100);
            lgs_mng_add_dim(dim_name, RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        }
    }

    /* Response code type - initialise */
    if(p_file_info->parser_config->chart_config & CHART_RESP_CODE_TYPE){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "response_types"                  // id
            , "Response Statuses"               // title
            , "requests"                        // units
            , "responses"                       // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("success", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("redirect", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("bad", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("error", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("other", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* SSL protocol - initialise */
    if(p_file_info->parser_config->chart_config & CHART_SSL_PROTO){
        lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "ssl_protocol"                    // id
            , "Requests Per SSL Protocol"       // title
            , "requests"                        // units
            , "ssl_protocol"                    // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );

        lgs_mng_add_dim("TLSV1", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("TLSV1.1", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("TLSV1.2", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("TLSV1.3", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("SSLV2", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("SSLV3", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
        lgs_mng_add_dim("other", RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
    }

    /* SSL cipher suite - initialise */
    if(p_file_info->parser_config->chart_config & CHART_SSL_CIPHER){
        chart_data->cs_ssl_ciphers = lgs_mng_create_chart(
            (char *) p_file_info->chartname     // type
            , "ssl_cipher_suite"                // id
            , "Requests by SSL cipher suite"    // title
            , "requests"                        // units
            , "ssl_cipher_suite"                // family
            , NULL                              // context
            , RRDSET_TYPE_AREA_NAME             // chart_type
            , ++chart_prio                      // priority
            , p_file_info->update_every         // update_every
        );
    }

    lgs_mng_do_custom_charts_init(p_file_info);
}


void web_log_chart_update(struct File_info *p_file_info){
    chart_data_web_log_t *chart_data = p_file_info->chart_meta->chart_data_web_log;
    Web_log_metrics_t *wlm = p_file_info->parser_metrics->web_log;

    if(chart_data->last_update != p_file_info->parser_metrics->last_update){

        time_t lag_in_sec = p_file_info->parser_metrics->last_update - chart_data->last_update - 1;

        lgs_mng_do_num_of_logs_charts_update(p_file_info, lag_in_sec, chart_data);

        /* Vhost - update */
        if(p_file_info->parser_config->chart_config & CHART_VHOST){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){

                lgs_mng_update_chart_begin(p_file_info->chartname, "vhost");
                for(int idx = 0; idx < chart_data->vhost_size; idx++)
                    lgs_mng_update_chart_set(wlm->vhost_arr.vhosts[idx].name, chart_data->num_vhosts[idx]);
                lgs_mng_update_chart_end(sec);
            }

            if(wlm->vhost_arr.size > chart_data->vhost_size){
                if(wlm->vhost_arr.size >= chart_data->vhost_size_max){
                    chart_data->vhost_size_max = wlm->vhost_arr.size * VHOST_BUFFS_SCALE_FACTOR + 1;
                    chart_data->num_vhosts = reallocz(  chart_data->num_vhosts, 
                                                        chart_data->vhost_size_max * sizeof(collected_number));

                }

                for(int idx = chart_data->vhost_size; idx < wlm->vhost_arr.size; idx++){
                    chart_data->num_vhosts[idx] = 0;
                    lgs_mng_add_dim_post_init(  &chart_data->cs_vhosts, 
                                        wlm->vhost_arr.vhosts[idx].name, 
                                        RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
                }
                
                chart_data->vhost_size = wlm->vhost_arr.size;
            }

            lgs_mng_update_chart_begin(p_file_info->chartname, "vhost");
            for(int idx = 0; idx < chart_data->vhost_size; idx++){
                chart_data->num_vhosts[idx] += wlm->vhost_arr.vhosts[idx].count;
                wlm->vhost_arr.vhosts[idx].count = 0;
                lgs_mng_update_chart_set(wlm->vhost_arr.vhosts[idx].name, chart_data->num_vhosts[idx]);
            }
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update); 
        }

        /* Port - update */
        if(p_file_info->parser_config->chart_config & CHART_PORT){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){

                lgs_mng_update_chart_begin(p_file_info->chartname, "port");
                for(int idx = 0; idx < chart_data->port_size; idx++)
                    lgs_mng_update_chart_set(wlm->port_arr.ports[idx].name, chart_data->num_ports[idx]);
                lgs_mng_update_chart_end(sec);
            }

            if(wlm->port_arr.size > chart_data->port_size){
                if(wlm->port_arr.size >= chart_data->port_size_max){
                    chart_data->port_size_max = wlm->port_arr.size * PORT_BUFFS_SCALE_FACTOR + 1;
                    chart_data->num_ports = reallocz(   chart_data->num_ports, 
                                                        chart_data->port_size_max * sizeof(collected_number));
                }

                for(int idx = chart_data->port_size; idx < wlm->port_arr.size; idx++){
                    chart_data->num_ports[idx] = 0;
                    lgs_mng_add_dim_post_init(  &chart_data->cs_ports, 
                                                wlm->port_arr.ports[idx].name, 
                                                RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
                }
                
                chart_data->port_size = wlm->port_arr.size;
            }

            lgs_mng_update_chart_begin(p_file_info->chartname, "port");
            for(int idx = 0; idx < chart_data->port_size; idx++){
                chart_data->num_ports[idx] += wlm->port_arr.ports[idx].count;
                wlm->port_arr.ports[idx].count = 0;
                lgs_mng_update_chart_set(wlm->port_arr.ports[idx].name, chart_data->num_ports[idx]);
            }
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update); 
        }

        /* IP Version - update */
        if(p_file_info->parser_config->chart_config & CHART_IP_VERSION){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){

                lgs_mng_update_chart_begin(p_file_info->chartname, "ip_version");
                lgs_mng_update_chart_set("ipv4", chart_data->num_ip_ver_4);
                lgs_mng_update_chart_set("ipv6", chart_data->num_ip_ver_6);
                lgs_mng_update_chart_set("invalid", chart_data->num_ip_ver_invalid);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_ip_ver_4 += wlm->ip_ver.v4;
            chart_data->num_ip_ver_6 += wlm->ip_ver.v6;
            chart_data->num_ip_ver_invalid += wlm->ip_ver.invalid;
            memset(&wlm->ip_ver, 0, sizeof(wlm->ip_ver));

            lgs_mng_update_chart_begin(p_file_info->chartname, "ip_version");
            lgs_mng_update_chart_set("ipv4", chart_data->num_ip_ver_4);
            lgs_mng_update_chart_set("ipv6", chart_data->num_ip_ver_6);
            lgs_mng_update_chart_set("invalid", chart_data->num_ip_ver_invalid);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update); 
        }

        /* Request client current poll - update */
        if(p_file_info->parser_config->chart_config & CHART_REQ_CLIENT_CURRENT){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "clients");
                lgs_mng_update_chart_set("ipv4", chart_data->num_req_client_current_ipv4);
                lgs_mng_update_chart_set("ipv6", chart_data->num_req_client_current_ipv6);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_req_client_current_ipv4 += wlm->req_clients_current_arr.ipv4_size;
            wlm->req_clients_current_arr.ipv4_size = 0;
            chart_data->num_req_client_current_ipv6 += wlm->req_clients_current_arr.ipv6_size;
            wlm->req_clients_current_arr.ipv6_size = 0;

            lgs_mng_update_chart_begin(p_file_info->chartname, "clients");
            lgs_mng_update_chart_set("ipv4", chart_data->num_req_client_current_ipv4);
            lgs_mng_update_chart_set("ipv6", chart_data->num_req_client_current_ipv6);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update); 
        }

        /* Request client all-time - update */
        if(p_file_info->parser_config->chart_config & CHART_REQ_CLIENT_ALL_TIME){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "clients_all");
                lgs_mng_update_chart_set("ipv4", chart_data->num_req_client_all_time_ipv4);
                lgs_mng_update_chart_set("ipv6", chart_data->num_req_client_all_time_ipv6);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_req_client_all_time_ipv4 = wlm->req_clients_alltime_arr.ipv4_size;  
            chart_data->num_req_client_all_time_ipv6 = wlm->req_clients_alltime_arr.ipv6_size;

            lgs_mng_update_chart_begin(p_file_info->chartname, "clients_all");
            lgs_mng_update_chart_set("ipv4", chart_data->num_req_client_all_time_ipv4);
            lgs_mng_update_chart_set("ipv6", chart_data->num_req_client_all_time_ipv6);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Request methods - update */
        if(p_file_info->parser_config->chart_config & CHART_REQ_METHODS){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "http_methods");
                for(int idx = 0; idx < REQ_METHOD_ARR_SIZE; idx++){
                    if(chart_data->num_req_method[idx])
                        lgs_mng_update_chart_set(req_method_str[idx], chart_data->num_req_method[idx]);
                }
                lgs_mng_update_chart_end(sec);
            }

            lgs_mng_update_chart_begin(p_file_info->chartname, "http_methods");
            for(int idx = 0; idx < REQ_METHOD_ARR_SIZE; idx++){
                chart_data->num_req_method[idx] += wlm->req_method[idx];
                wlm->req_method[idx] = 0;
                if(chart_data->num_req_method[idx])
                    lgs_mng_update_chart_set(req_method_str[idx], chart_data->num_req_method[idx]);
            }
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Request protocol - update */
        if(p_file_info->parser_config->chart_config & CHART_REQ_PROTO){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "http_versions");
                lgs_mng_update_chart_set("1.0", chart_data->num_req_proto_http_1);
                lgs_mng_update_chart_set("1.1", chart_data->num_req_proto_http_1_1);
                lgs_mng_update_chart_set("2.0", chart_data->num_req_proto_http_2);
                lgs_mng_update_chart_set("other", chart_data->num_req_proto_other);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_req_proto_http_1 += wlm->req_proto.http_1;
            chart_data->num_req_proto_http_1_1 += wlm->req_proto.http_1_1;
            chart_data->num_req_proto_http_2 += wlm->req_proto.http_2;
            chart_data->num_req_proto_other += wlm->req_proto.other;
            memset(&wlm->req_proto, 0, sizeof(wlm->req_proto));

            lgs_mng_update_chart_begin(p_file_info->chartname, "http_versions");
            lgs_mng_update_chart_set("1.0", chart_data->num_req_proto_http_1);
            lgs_mng_update_chart_set("1.1", chart_data->num_req_proto_http_1_1);
            lgs_mng_update_chart_set("2.0", chart_data->num_req_proto_http_2);
            lgs_mng_update_chart_set("other", chart_data->num_req_proto_other);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Request bandwidth - update */
        if(p_file_info->parser_config->chart_config & CHART_BANDWIDTH){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "bandwidth");
                lgs_mng_update_chart_set("received", chart_data->num_bandwidth_req_size);
                lgs_mng_update_chart_set("sent", chart_data->num_bandwidth_resp_size);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_bandwidth_req_size += wlm->bandwidth.req_size;
            chart_data->num_bandwidth_resp_size += wlm->bandwidth.resp_size;
            memset(&wlm->bandwidth, 0, sizeof(wlm->bandwidth));

            lgs_mng_update_chart_begin(p_file_info->chartname, "bandwidth");
            lgs_mng_update_chart_set("received", chart_data->num_bandwidth_req_size);
            lgs_mng_update_chart_set("sent", chart_data->num_bandwidth_resp_size);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Request proc time - update */
        if(p_file_info->parser_config->chart_config & CHART_REQ_PROC_TIME){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "timings");
                lgs_mng_update_chart_set("min", chart_data->num_req_proc_time_min);
                lgs_mng_update_chart_set("max", chart_data->num_req_proc_time_max);
                lgs_mng_update_chart_set("avg", chart_data->num_req_proc_time_avg);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_req_proc_time_min = wlm->req_proc_time.min;
            chart_data->num_req_proc_time_max = wlm->req_proc_time.max;
            chart_data->num_req_proc_time_avg = wlm->req_proc_time.count ? 
                wlm->req_proc_time.sum / wlm->req_proc_time.count : 0;
            memset(&wlm->req_proc_time, 0, sizeof(wlm->req_proc_time));

            lgs_mng_update_chart_begin(p_file_info->chartname, "timings");
            lgs_mng_update_chart_set("min", chart_data->num_req_proc_time_min);
            lgs_mng_update_chart_set("max", chart_data->num_req_proc_time_max);
            lgs_mng_update_chart_set("avg", chart_data->num_req_proc_time_avg);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Response code family - update */
        if(p_file_info->parser_config->chart_config & CHART_RESP_CODE_FAMILY){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
            
                lgs_mng_update_chart_begin(p_file_info->chartname, "responses");
                lgs_mng_update_chart_set("1xx", chart_data->num_resp_code_family_1xx);
                lgs_mng_update_chart_set("2xx", chart_data->num_resp_code_family_2xx);
                lgs_mng_update_chart_set("3xx", chart_data->num_resp_code_family_3xx);
                lgs_mng_update_chart_set("4xx", chart_data->num_resp_code_family_4xx);
                lgs_mng_update_chart_set("5xx", chart_data->num_resp_code_family_5xx);
                lgs_mng_update_chart_set("other", chart_data->num_resp_code_family_other);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_resp_code_family_1xx += wlm->resp_code_family.resp_1xx;
            chart_data->num_resp_code_family_2xx += wlm->resp_code_family.resp_2xx;
            chart_data->num_resp_code_family_3xx += wlm->resp_code_family.resp_3xx;
            chart_data->num_resp_code_family_4xx += wlm->resp_code_family.resp_4xx;
            chart_data->num_resp_code_family_5xx += wlm->resp_code_family.resp_5xx;
            chart_data->num_resp_code_family_other += wlm->resp_code_family.other;
            memset(&wlm->resp_code_family, 0, sizeof(wlm->resp_code_family));
            
            lgs_mng_update_chart_begin(p_file_info->chartname, "responses");
            lgs_mng_update_chart_set("1xx", chart_data->num_resp_code_family_1xx);
            lgs_mng_update_chart_set("2xx", chart_data->num_resp_code_family_2xx);
            lgs_mng_update_chart_set("3xx", chart_data->num_resp_code_family_3xx);
            lgs_mng_update_chart_set("4xx", chart_data->num_resp_code_family_4xx);
            lgs_mng_update_chart_set("5xx", chart_data->num_resp_code_family_5xx);
            lgs_mng_update_chart_set("other", chart_data->num_resp_code_family_other);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Response code - update */
        if(p_file_info->parser_config->chart_config & CHART_RESP_CODE){
            char dim_name[4];

            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "detailed_responses");
                for(int idx = 0; idx < RESP_CODE_ARR_SIZE - 1; idx++){
                    if(chart_data->num_resp_code[idx]){
                        snprintfz(dim_name, 4, "%d", idx + 100);
                        lgs_mng_update_chart_set(dim_name, chart_data->num_resp_code[idx]);
                    }
                }
                if(chart_data->num_resp_code[RESP_CODE_ARR_SIZE - 1])
                    lgs_mng_update_chart_set("other", chart_data->num_resp_code[RESP_CODE_ARR_SIZE - 1]);
                lgs_mng_update_chart_end(sec);
            }

            lgs_mng_update_chart_begin(p_file_info->chartname, "detailed_responses");
            for(int idx = 0; idx < RESP_CODE_ARR_SIZE - 1; idx++){
                chart_data->num_resp_code[idx] += wlm->resp_code[idx];
                wlm->resp_code[idx] = 0;
                if(chart_data->num_resp_code[idx]){
                    snprintfz(dim_name, 4, "%d", idx + 100);
                    lgs_mng_update_chart_set(dim_name, chart_data->num_resp_code[idx]);
                }
            }
            chart_data->num_resp_code[RESP_CODE_ARR_SIZE - 1] += wlm->resp_code[RESP_CODE_ARR_SIZE - 1];
            wlm->resp_code[RESP_CODE_ARR_SIZE - 1] = 0;
            if(chart_data->num_resp_code[RESP_CODE_ARR_SIZE - 1])
                lgs_mng_update_chart_set("other", chart_data->num_resp_code[RESP_CODE_ARR_SIZE - 1]);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* Response code type - update */
        if(p_file_info->parser_config->chart_config & CHART_RESP_CODE_TYPE){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "response_types");
                lgs_mng_update_chart_set("success", chart_data->num_resp_code_type_success);
                lgs_mng_update_chart_set("redirect", chart_data->num_resp_code_type_redirect);
                lgs_mng_update_chart_set("bad", chart_data->num_resp_code_type_bad);
                lgs_mng_update_chart_set("error", chart_data->num_resp_code_type_error);
                lgs_mng_update_chart_set("other", chart_data->num_resp_code_type_other);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_resp_code_type_success += wlm->resp_code_type.resp_success;
            chart_data->num_resp_code_type_redirect += wlm->resp_code_type.resp_redirect;
            chart_data->num_resp_code_type_bad += wlm->resp_code_type.resp_bad;
            chart_data->num_resp_code_type_error += wlm->resp_code_type.resp_error;
            chart_data->num_resp_code_type_other += wlm->resp_code_type.other;
            memset(&wlm->resp_code_type, 0, sizeof(wlm->resp_code_type));

            lgs_mng_update_chart_begin(p_file_info->chartname, "response_types");
            lgs_mng_update_chart_set("success", chart_data->num_resp_code_type_success);
            lgs_mng_update_chart_set("redirect", chart_data->num_resp_code_type_redirect);
            lgs_mng_update_chart_set("bad", chart_data->num_resp_code_type_bad);
            lgs_mng_update_chart_set("error", chart_data->num_resp_code_type_error);
            lgs_mng_update_chart_set("other", chart_data->num_resp_code_type_other);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* SSL protocol - update */
        if(p_file_info->parser_config->chart_config & CHART_SSL_PROTO){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "ssl_protocol");
                lgs_mng_update_chart_set("TLSV1", chart_data->num_ssl_proto_tlsv1);
                lgs_mng_update_chart_set("TLSV1.1", chart_data->num_ssl_proto_tlsv1_1);
                lgs_mng_update_chart_set("TLSV1.2", chart_data->num_ssl_proto_tlsv1_2);
                lgs_mng_update_chart_set("TLSV1.3", chart_data->num_ssl_proto_tlsv1_3);
                lgs_mng_update_chart_set("SSLV2", chart_data->num_ssl_proto_sslv2);
                lgs_mng_update_chart_set("SSLV3", chart_data->num_ssl_proto_sslv3);
                lgs_mng_update_chart_set("other", chart_data->num_ssl_proto_other);
                lgs_mng_update_chart_end(sec);
            }

            chart_data->num_ssl_proto_tlsv1 += wlm->ssl_proto.tlsv1;
            chart_data->num_ssl_proto_tlsv1_1 += wlm->ssl_proto.tlsv1_1;
            chart_data->num_ssl_proto_tlsv1_2 += wlm->ssl_proto.tlsv1_2;
            chart_data->num_ssl_proto_tlsv1_3 += wlm->ssl_proto.tlsv1_3;
            chart_data->num_ssl_proto_sslv2 += wlm->ssl_proto.sslv2;
            chart_data->num_ssl_proto_sslv3 += wlm->ssl_proto.sslv3;
            chart_data->num_ssl_proto_other += wlm->ssl_proto.other;
            memset(&wlm->ssl_proto, 0, sizeof(wlm->ssl_proto));

            lgs_mng_update_chart_begin(p_file_info->chartname, "ssl_protocol");
            lgs_mng_update_chart_set("TLSV1", chart_data->num_ssl_proto_tlsv1);
            lgs_mng_update_chart_set("TLSV1.1", chart_data->num_ssl_proto_tlsv1_1);
            lgs_mng_update_chart_set("TLSV1.2", chart_data->num_ssl_proto_tlsv1_2);
            lgs_mng_update_chart_set("TLSV1.3", chart_data->num_ssl_proto_tlsv1_3);
            lgs_mng_update_chart_set("SSLV2", chart_data->num_ssl_proto_sslv2);
            lgs_mng_update_chart_set("SSLV3", chart_data->num_ssl_proto_sslv3);
            lgs_mng_update_chart_set("other", chart_data->num_ssl_proto_other);
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update);
        }

        /* SSL cipher suite - update */
        if(p_file_info->parser_config->chart_config & CHART_SSL_CIPHER){
            for(time_t  sec = p_file_info->parser_metrics->last_update - lag_in_sec;
                        sec < p_file_info->parser_metrics->last_update;
                        sec++){
                
                lgs_mng_update_chart_begin(p_file_info->chartname, "ssl_cipher_suite");
                for(int idx = 0; idx < chart_data->ssl_cipher_size; idx++){
                    lgs_mng_update_chart_set(   wlm->ssl_cipher_arr.ssl_ciphers[idx].name, 
                                                chart_data->num_ssl_ciphers[idx]);
                }
                lgs_mng_update_chart_end(sec);
            }

            if(wlm->ssl_cipher_arr.size > chart_data->ssl_cipher_size){
                chart_data->ssl_cipher_size = wlm->ssl_cipher_arr.size;
                chart_data->num_ssl_ciphers = reallocz( chart_data->num_ssl_ciphers, 
                                                        chart_data->ssl_cipher_size * sizeof(collected_number));

                for(int idx = chart_data->ssl_cipher_size; idx < wlm->ssl_cipher_arr.size; idx++){
                    chart_data->num_ssl_ciphers[idx] = 0;
                    lgs_mng_add_dim_post_init(  &chart_data->cs_ssl_ciphers, 
                                                wlm->ssl_cipher_arr.ssl_ciphers[idx].name, 
                                                RRD_ALGORITHM_INCREMENTAL_NAME, 1, 1);
                }

                chart_data->ssl_cipher_size = wlm->ssl_cipher_arr.size;
            }

            lgs_mng_update_chart_begin(p_file_info->chartname, "ssl_cipher_suite");
            for(int idx = 0; idx < chart_data->ssl_cipher_size; idx++){
                chart_data->num_ssl_ciphers[idx] += wlm->ssl_cipher_arr.ssl_ciphers[idx].count;
                wlm->ssl_cipher_arr.ssl_ciphers[idx].count = 0;
                lgs_mng_update_chart_set(   wlm->ssl_cipher_arr.ssl_ciphers[idx].name, 
                                            chart_data->num_ssl_ciphers[idx]);
            }
            lgs_mng_update_chart_end(p_file_info->parser_metrics->last_update); 
        }
        
        lgs_mng_do_custom_charts_update(p_file_info, lag_in_sec);

        chart_data->last_update = p_file_info->parser_metrics->last_update;
    }
}