This file is indexed.

/usr/share/doc/samhain/manual.html/logmon.html is in samhain 2.8.3a-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Logfile monitoring/analysis</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="The Samhain Host Integrity Monitoring System"
HREF="index.html"><LINK
REL="UP"
TITLE="Configuring samhain, the host integrity monitor"
HREF="file-monitor.html"><LINK
REL="PREVIOUS"
TITLE="Checking for open ports"
HREF="portcheck.html"><LINK
REL="NEXT"
TITLE="Checking the Windows registry"
HREF="winreg.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="./docbook.css"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Samhain Host Integrity Monitoring System</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="portcheck.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Configuring <SPAN
CLASS="APPLICATION"
>samhain</SPAN
>, the host integrity monitor</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="winreg.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="LOGMON"
>5.16. Logfile monitoring/analysis</A
></H1
><P
>  This option is available with <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> version
  2.5.0 and higher. To compile with support for this option, use the 
  configure option 
  </P
><P
>  <B
CLASS="COMMAND"
>./configure --enable-logfile-monitor</B
>
  </P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>PCRE library required</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>    This option requires the PCRE (Perl Compatible Regular Expressions)
    library. Many Linux distributions split library packages into a
    runtime package (required to run a dependent executable) and a
    development package (required to compile an executable). At least
    on the build host where <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> is
    compiled, the development package is required if you use this option.
  </P
></TD
></TR
></TABLE
></DIV
><P
>  This module enables <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> to 
  monitor/analyze
  logfiles of other applications. Currently 
  (<SPAN
CLASS="APPLICATION"
>samhain</SPAN
> 2.5.0) the following
  logfile formats are supported:
  <P
></P
><UL
><LI
><P
>	 Syslog
	 </P
></LI
><LI
><P
>	 Apache (access and error log)
	 </P
></LI
><LI
><P
>	 Samba
	 </P
></LI
><LI
><P
>	 'pacct' BSD-style process accounting (also available on Linux)
	 </P
></LI
></UL
>
  </P
><P
>    Logfile analysis will always start from the point the last one
    ended; the pointer into the file is stored persistently on disk.
    Logfile rotation is handled automatically as long as the rotated
    logfile remains in the same directory and is 
    <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not compressed</I
></SPAN
> (usually log rotation tools
    can be configured to compress only after the second rotation,
    which is advisable for unrelated reasons - the logging application
    may still have an open file pointer after logfile rotation).
  </P
><P
>    Logfile entries can be filtered with Perl-style 
    regular expressions (filter rules). Regular expressions must
    match <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>the whole logfile record</I
></SPAN
>.
    For efficiency, regular expressions can be grouped under a common
    regular expression, i.e. if the group expression fails to match,
    no RE in the group is tried. Furthermore, (groups of) regular expressions
    can be grouped by host, if the logfile(s) contain host information
    (such as host information in centralized syslog server logfiles, 
    or virtual host information in Apache logfiles). Note that
    host-&gt;group-&gt;rule is supported (just as host-&gt;rule or
    group-&gt;rule), while group-&gt;host-&gt;&gt;rule
    isn't.
  </P
><P
>    Each filtering rule (regular expression) is assigned to an output
    queue. Currently (<SPAN
CLASS="APPLICATION"
>samhain</SPAN
> 2.5.0) queues
    only differ in the assigned severity of an event, but more options
    (per-queue mail addresses for alerts) are under development.
  </P
><P
>   Filtering rules are processed in the order given in the configuration 
   file, i.e. the first match wins.
  </P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Blacklisting vs. whitelisting, and the 'trash' output queue</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>    Output queues are labelled. The label 'trash' is reserved and
    refers to the trash bin (no output, throw away log entries
    if the matching rule is assigned to the 'trash' queue).
  </P
><P
>    If a logfile entry does not match any rule, it is reported
    (i.e. the default is <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>whitelisting</I
></SPAN
> known-good
    entries). To
    turn this into a <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>blacklisting</I
></SPAN
> policy, simply
    add a catch-all rule at the end and assign it to the 'trash' queue.
  </P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2828"
>5.16.1. Event Correlation</A
></H2
><P
>    Sometimes it is desirable to report on the fact that several events
    happend at a similar time, possibly in a particular order. As of
    version 2.6.1, <SPAN
CLASS="APPLICATION"
>samhain</SPAN
> supports this in the
    following way:
  </P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN2832"
>5.16.1.1. Marking individual events to be correlated</A
></H3
><P
>    First, individual events to be correlated need to be marked for
    keeping them, under an arbitrary user-defined label, for an arbitrary
    user-defined time. So the rule for matching an event has to be
    modified like this:
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=KEEP(<TT
CLASS="REPLACEABLE"
><I
>seconds,label</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label</I
></TT
>:<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
>
  matches a logfile entry against the provided regular expression, AND keeps
  it for the specified time in <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>seconds</I
></SPAN
>, with the specified
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>label</I
></SPAN
>. In other words, processing of this rule will
  be no different than other rules, except for the fact that also a memory of 
  the event is kept for the specified amount of time. So if you e.g. don't 
  want a separate report for this individual event, just assign it to
  the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>trash</I
></SPAN
> queue.
  </P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN2843"
>5.16.1.2. Correlating the marked events</A
></H3
><P
>    To correlate events labelled <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>label_one</I
></SPAN
>, 
    <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>label_two</I
></SPAN
>, etc., just build a regular expression 
    that matches the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>labels</I
></SPAN
>, in the temporal order 
    you want to check for. E.g. if the temporal order is irrelevant, you 
    may want to match 
    <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>(label_one.*label_two)|(label_two.*label_one)</I
></SPAN
>.
    Use this expression in a rule maked as 
    CORRELATE(<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>description</I
></SPAN
>), like this:
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=CORRELATE(<TT
CLASS="REPLACEABLE"
><I
>description</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label</I
></TT
>:<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
>
  </P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Old records in existing logfiles</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>    Because the 'keep' timeout is relative to the current time, correlation
    of old entries in logfiles (i.e. when, at startup, an existing logfile
    with old entries is scanned) will only work if you specify 'keep' 
    timeouts that are long enough to cover the whole timespan from the 
    first logfile record until now.
  </P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2859"
>5.16.2. Reporting non-occurence of an event</A
></H2
><P
>    To check whether a given event occurs at least once within some
    given interval, the rule for matching an event can be modified
    like this:
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=MARK(<TT
CLASS="REPLACEABLE"
><I
>seconds,description</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label</I
></TT
>:<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
>
  matches a logfile entry against the provided regular expression, AND 
  checks whether is occurs at least once within the specified interval 
  (seconds).
  </P
><P
>  Processing of this rule will
  be no different than other rules otherwise, so if you e.g. only 
  want a report for this event if it is missing, just assign it to
  the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>trash</I
></SPAN
> queue. However, in the latter case
  the severity for reporting the messages must be set separately
  with the LogmonMarkSeverity directive, because the 'trash' queue
  has no severity assigned:
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonMarkSeverity=<TT
CLASS="REPLACEABLE"
><I
>severity</I
></TT
></B
>  &mdash; Severity for reports on missing heartbeat messages if the messages themselves are assigned to the 'trash' queue (default: crit).
  </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2872"
>5.16.3. Reporting bursts of similar, repeated events</A
></H2
><P
>    <SPAN
CLASS="APPLICATION"
>Samhain</SPAN
> can automatically detect and report
    bursts of similar, repeated events in the monitored logfiles. Here
    <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>similar, repeated events</I
></SPAN
> refers to events that
    differ (only) in details that can be expected to differ for
    events of the same kind: IP adresses, FQDNs, email adresses, and numbers.
    The event history goes back 12 minutes, and
    thus a report is triggered if the number of similar events within the last 
    12 minutes exceeds a given threshold (default: 24).
  </P
><P
>    This feature is <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>off</I
></SPAN
> by default. In order to
    switch it on, you need to set a reporting queue:
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstQueue=<TT
CLASS="REPLACEABLE"
><I
>queue</I
></TT
></B
>  &mdash; Set the reporting queue for reporting bursts of similar log messages (default: don't report).
  </P
><P
>    In addition, there are two more configurable parameters, one to
    set the triggering threshold (i.e. the number of messages within
    12 minutes that need to be exceeded to raise an alert), and another
    one to indicate whether messages from the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>cron</I
></SPAN
>
    daemon should be considered as well (default: no):
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstThreshold=<TT
CLASS="REPLACEABLE"
><I
>number</I
></TT
></B
>  &mdash; The number of repeated messages within 12 minutes that must be exceeded to report a burst of repeated messages (default: 24).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstCron=<TT
CLASS="REPLACEABLE"
><I
>boolean</I
></TT
></B
>  &mdash; Whether to report also on bursts of repeated cron messages (default: false).
  </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2890"
>5.16.4. Options</A
></H2
><P
>  <B
CLASS="COMMAND"
>LogmonActive=<TT
CLASS="REPLACEABLE"
><I
>boolean</I
></TT
></B
> switches
  this module on or off (default: off).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonSaveDir=<TT
CLASS="REPLACEABLE"
><I
>/absolute/path</I
></TT
></B
> 
  sets the directory where checkpoint data for logfiles is stored (default: 
  same as for database file).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonClean=<TT
CLASS="REPLACEABLE"
><I
>boolean</I
></TT
></B
> 
  delete old checkpoint data unmodified for 30 days or more (default: off). 
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonInterval=<TT
CLASS="REPLACEABLE"
><I
>seconds</I
></TT
></B
> sets the
  interval for logfile checking (default: 10 seconds).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonMarkSeverity=<TT
CLASS="REPLACEABLE"
><I
>severity</I
></TT
></B
>  &mdash; Severity for reports on missing heartbeat messages if the messages themselves are assigned to the 'trash' queue (default: crit).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstThreshold=<TT
CLASS="REPLACEABLE"
><I
>number</I
></TT
></B
>  &mdash; The number of repeated messages within 12 minutes that must be exceeded to report a burst of repeated messages (default: 24).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstQueue=<TT
CLASS="REPLACEABLE"
><I
>queue</I
></TT
></B
>  &mdash; Set the reporting queue for reporting bursts of similar log messages (default: don't report).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonBurstCron=<TT
CLASS="REPLACEABLE"
><I
>boolean</I
></TT
></B
>  &mdash; Whether to report also on bursts of repeated cron messages (defaul: false).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonWatch=<TT
CLASS="REPLACEABLE"
><I
>TYPE:path[:format]</I
></TT
></B
> 
  advises the module to monitor the logfile with the specified <TT
CLASS="FILENAME"
>path</TT
>,
  which is of type 'TYPE' (logfile types are uppercase). 
  Some logfile types (e.g. Apache access logs) can be
  customized, and hence some <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>format</I
></SPAN
> information must be provided. Currently
  (<SPAN
CLASS="APPLICATION"
>samhain</SPAN
> 2.6.4) the following logfile types are supported
  <P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>SYSLOG</DT
><DD
><P
>     Standard UNIX style syslog files. Matching starts at the command (i.e. after
     the hostname). To select certain hostnames, place the rule under a LogmonHost
     directive (see below). If the LogmonHidePID option is used, the RE should not
     account for the process PID.
     </P
></DD
><DT
>APACHE</DT
><DD
><P
>     Apache (or compatible) webserver access and/or error logs. Required 
     <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>format</I
></SPAN
> information: either one 
     of <TT
CLASS="REPLACEABLE"
><I
>combined</I
></TT
>,
     <TT
CLASS="REPLACEABLE"
><I
>common</I
></TT
>, or <TT
CLASS="REPLACEABLE"
><I
>error</I
></TT
>
     (error log), or the Apache custom log format specification used. The
     whole log line is matched. If there are virtual hosts (%v), then
     the LogmonHost directive will match the virtual host.
     </P
></DD
><DT
>SAMBA</DT
><DD
><P
>     Samba logfile format (multiline, timestamp and origin within samba source code
     on first line, log message on continuation lines). The RE will match the
     continuation line (with the log message) only.
     </P
></DD
><DT
>PACCT</DT
><DD
><P
>     BSD style process accounting (also available on Linux). This is a binary
     logfile. The module will build a text line like the 'last' command does,
     and match it against the RE.
     </P
><P
>     <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>What is pacct good for?</I
></SPAN
> Note that pacct records 
     contain only the executable name, not the arguments.
     This may look somewhat useless for shell accounts, but is quite useful
     for servers: how many different commands can e.g. <SPAN
CLASS="APPLICATION"
>postfix</SPAN
>
     legitimately execute? Just a handful, indeed, and certainly none of them
     is /bin/sh! So if pacct says that the 'postfix' user has executed a shell, then
     this would be rather alarming...
     </P
></DD
><DT
>SHELL</DT
><DD
><P
>     A shell command. The full output on stdout will be read and matched. The PATH
     environment variable will be set to <TT
CLASS="REPLACEABLE"
><I
>/sbin:/bin:/usr/sbin:/usr/bin:/usr/ucb</I
></TT
>,
     and the SHELL, IFS, and TZ variables will be defined. The command is executed
     via <B
CLASS="COMMAND"
>/bin/sh -c <TT
CLASS="REPLACEABLE"
><I
>command</I
></TT
></B
>.
     </P
></DD
></DL
></DIV
>
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonHidePID=<TT
CLASS="REPLACEABLE"
><I
>boolean</I
></TT
></B
> is an option
  that only affects logfiles of type SYSLOG. It causes the PID to be stripped
  from the log line (before matching against the RE).
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonQueue=<TT
CLASS="REPLACEABLE"
><I
>label:[interval]:(sum|report):severity[:alias]</I
></TT
></B
> 
  defines an output queue. Here, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>label</I
></SPAN
> is an arbitrary 
  name which is used to assign rules to this queue; 
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>interval</I
></SPAN
> is the timespan over
  which messages are summarized if the queue is of type 'sum'; 
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>sum</I
></SPAN
> (summarize over some interval) or
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>report</I
></SPAN
> (report each event seperately and immediately) 
  are the two
  queue type supported, and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>severity</I
></SPAN
> is the severity 
  assigned to an event. Furthermore, optionally it is possible to
  specify an <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>alias</I
></SPAN
> (must be defined in the email
  configuration) to direct email for this rule to a specific list
  of recipients.
  </P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="MIDDLE"
><B
>Email</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>    If you spefify a list alias, email will still go to all defined
    email recipients unless filtered, e.g. with
  </P
><PRE
CLASS="PROGRAMLISTING"
>    SetMailFilterNot = \[Logfile\]
  </PRE
><P
>    I.e. you may want to define recipients, filter them as above, and
    then define list aliases to be used in an event queue. See
    <A
HREF="configuration-email.html"
>Section 4.4</A
>&#62; for more information.
  </P
></TD
></TR
></TABLE
></DIV
><P
>  <B
CLASS="COMMAND"
>LogmonHost=<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
> causes
  the following rules to be applied only to entries for this host(s). It is ended
  implicitely by another LogmonHost directive, or explicitely by a LogmonEndHost
  directive.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonEndHost</B
> explicitely ends a preceding LogmonHost
  directive.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonGroup=<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
> causes
  the following rules to be applied only if the group regex matches (i.e. rules
  within the group are skipped if the group regex doesn't match. This can be used
  to improve speed/efficiency of matching, i.e. you can group regexes by a common
  prefix. A group is ended
  implicitely by another LogmonGroup directive, or explicitely by a LogmonEndGroup
  directive.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonEndGroup</B
> explicitely ends a preceding LogmonGroup
  directive. 
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=<TT
CLASS="REPLACEABLE"
><I
>queue_label:(perl)regex</I
></TT
></B
>
  matches a logfile entry against the provided regular expression. If the expression
  matches, then <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>captured</I
></SPAN
> subexpressions are replaced 
  by '___', and the logfile entry is reported as specified for the queue referenced 
  by <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>queue_label</I
></SPAN
>. Non-captured subexpressions (i.e.
  subexpressions where the opening bracket is followed by '?:') are 
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>not replaced</I
></SPAN
> by '___', but reported literally.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=KEEP(<TT
CLASS="REPLACEABLE"
><I
>seconds,label</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label:(perl)regex</I
></TT
></B
>
  as above, but additionally keep the event <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>label</I
></SPAN
> for 
  <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>seconds</I
></SPAN
> to perform event correlation.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=CORRELATE(<TT
CLASS="REPLACEABLE"
><I
>description</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label</I
></TT
>:<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
> perform 
  event correlation by matching the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>labels</I
></SPAN
> (as specified 
  in KEEP rules) of a sequence of events against the given regular expression.
  </P
><P
>  <B
CLASS="COMMAND"
>LogmonRule=MARK(<TT
CLASS="REPLACEABLE"
><I
>seconds,description</I
></TT
>):<TT
CLASS="REPLACEABLE"
><I
>queue_label</I
></TT
>:<TT
CLASS="REPLACEABLE"
><I
>(perl)regex</I
></TT
></B
>
  matches a logfile entry against the provided regular expression, AND 
  checks whether is occurs at least once within the specified interval 
  (seconds).
  </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN3004"
>5.16.5. Example configuration</A
></H2
><PRE
CLASS="PROGRAMLISTING"
>  [Logmon]

  #
  # Switch on the module
  #
  LogmonActive = yes

  # Check every second
  #
  LogmonInterval = 1

  # Strip PIDs from syslog messages
  #
  Logmonhidepid = true

  # Define a queue with severity 'crit'.
  # This is a 'report' queue, hence 'interval' (10)
  # will be ignored.
  #
  LogmonQueue = q1:10:report:crit

  # Define a second queue with severity 'alert'
  # 
  LogmonQueue = q2:10:report:alert

  # Monitor /var/log/messages, which is a syslog file
  #
  LogmonWatch = SYSLOG:/var/log/messages

  # Monitor /var/log/samba/log.nmbd, which is a samba
  # logfile
  #
  LogmonWatch = SAMBA:/var/log/samba/log.nmbd

  # Monitor /var/log/apache2/access.log, which is
  # an Apache logfile in 'combined' format
  #
  LogmonWatch = APACHE:/var/log/apache2/access.log:combined

  # Monitor disks to check for full /dev/sda1
  #
  LogmonWatch = SHELL:df -h

  # Syslog messages for the pppd deamon
  #
  LogmonGroup = g1:pppd.*
    #
    # Rules in this group
    #
    LogmonRule     = q1:pppd:\s+primary.*
    LogmonRule     = q1:pppd:\s+secondary.*
 #
 LogmonEndGroup

 # Warn about disk /dev/sda1 nearly full (80% or more. Use a 
 # non-capturing subexpression [the (?:8|9)] for the percentage full.
 #
 LogmonRule     = q1:/dev/sda1\s+[0-9GM.]+\s+[0-9GM.]+\s+[0-9GM.]+\s+(?:8|9).%.*

 # Messages starting with WARNING (some samba stuff)
 #
 LogmonGroup = g2:WARNING.*
   LogmonRule     = q2:.*interfaces.*
 LogmonEndGroup

 # Throw away all non-matching entries. This amounts
 # to a blacklist policy (only report known bad).
 #
 # Usually considered bad practice!!! Use whitelisting!
 #
 # 'trash' is a built in queue, no definition needed.
 #
 LogmonRule = trash:.*

  </PRE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="portcheck.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="winreg.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Checking for open ports</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="file-monitor.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Checking the Windows registry</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>