LINUX.ORG.RU
решено ФорумAdmin

Bacula Exclude RegexDir

 


0

2

Содержимое «/home/usr1cv8/.1cv8/1C/1cv8»

# ls -l
total 176
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Apr  1 15:50 08410b14-a2f7-454b-92de-ab91808b77f3
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 16  2023 111f29b5-b0d4-481b-a691-c0ad9b5dfa1d
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 21 20:28 114885d7-67d2-41f5-8c68-5532f1240293
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 16  2023 14f21ed5-11c4-4d4d-a0f4-306d91151391
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 17 17:40 19bdf6ce-189e-4630-9362-0d12190c87fa
-rw-r-----  1 usr1cv8 grp1cv8 18480 Apr 22 09:58 1cv8conn.pfl
-rw-r-----  1 usr1cv8 grp1cv8  2368 Apr 22 01:59 1cv8u.pfl
-rw-r-----  1 usr1cv8 grp1cv8   524 Jul  6  2021 1cv8wsrv.lst
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Jan 19 12:19 210dc968-e03d-4a8c-8e93-ccbeaa0e7a49
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Dec 25 20:06 21e2e863-1ac0-4607-8335-bc63aaa86187
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 17 16:53 2f112e3c-3b7f-4b3b-a464-24be45066c8f
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Apr 15 19:39 2fc630dc-1bb5-4b9c-9e03-579ac34beb48
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Nov  9 23:31 3027a763-a3ef-4185-a850-5c9e7b00353b
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 16  2023 312aab3e-60b6-47ef-ab96-eb5c5183bae3
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 21 17:34 39fb3f6f-c6b9-4f4b-a6e4-d764c7f6ef92
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 15 16:34 42f78e52-ae4c-4075-83b0-7a3f1ec44ccf
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 13  2023 48d1b5b1-8d07-4877-8b24-f2631d3feb33
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 17 19:35 4a6d8323-ee4f-419c-a0f4-93bc356c7db9
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 29 14:48 6a0ec55c-117e-41b8-bfa9-7ac743beb81e
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 22 02:00 7140926a-465e-4a88-becd-fdb128aeab7c
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Dec 18 12:01 72ade77e-95ec-4e49-b643-77df4223a827
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 16  2023 72f45430-3c32-4962-a00d-9455c69d2678
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 19 18:05 9e121229-85d7-4d00-8b16-ec55034fa2c3
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 16  2023 9e41e607-908c-49af-9865-f72e6ea6ec24
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 21 23:29 9f087a2a-0fd5-425e-a1f1-b2f102e84839
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 13  2022 a2dfd0be-4f63-4c37-b534-884d7e2028d9
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan  4  2023 a98700e1-2137-4d16-9145-1769d07ee49f
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Dec  6 10:13 aa6af1ed-49e9-49d5-b2bf-49c0e7516d2b
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 14 19:39 c1accc46-aa6c-4c83-bb0f-4b9562eb7c21
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 May 27  2023 cb0588d4-56ac-451d-bce8-9aa5069b0e53
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 17 17:16 d0a482e8-3c2a-40e1-8df6-14b9f5afc2f1
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Dec 29 18:22 d46c2ab3-4983-4aa3-9392-a0d6872eea4f
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Jan 12  2023 f3d9437b-0ea9-482e-b9c5-677d60e299e9
drwxrwxrwx  2 usr1cv8 grp1cv8  4096 Mar 14 19:36 f75e1738-9a71-4f8e-962c-6dfdefd818ea
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 15 17:41 f84a22e8-950f-4175-8748-d02123a1f0f0
drwxr-xr-x  2 usr1cv8 grp1cv8  4096 Apr 18 11:29 grcmncfg
drwxr-xr-x  9 usr1cv8 grp1cv8 12288 Apr 22 10:57 logs
drwxr-xr-x 41 usr1cv8 grp1cv8  4096 Apr 22 11:35 reg_1541
root@h231:/home/usr1cv8/.1cv8/1C/1cv8#

Требуется исключить директории кеша (пример именования)

/home/usr1cv8/.1cv8/1C/1cv8/reg_1541/08410b14-a2f7-454b-92de-ab91808b77f3/

Требуется исключить логи

/home/usr1cv8/.1cv8/1C/1cv8/logs/

Текст fileset


Fileset {
  Name = 1cv8-files
  Include {
    Options {
      Exclude = yes
        RegexDir = "^.*usr1cv8.*\S{8,15}-\S{4}-\S{4}-\S{4}-\S{12}.*$"
        RegexDir = "^.*usr1cv8.*logs.*$"
    }
    File = "/home/usr1cv8/.1cv8"
    File = "/var/1C/licenses"
    File = "/var/www"
    File = "/etc/apache2"
    File = "/opt/1cv8/conf"
  }
}
Исключения не срабатывают

★★★★★

Не успешно

Fileset {
  Name = 1cv8-files
  Include {
    Options {
      RegexDir = "\w{8,15}-\S{4}-\S{4}-\S{4}-\S{12}"
      RegexDir = "logs"
      Exclude = yes
    }
    Options {
      wild = "*"
    }
    File = "/home/usr1cv8/.1cv8"
    File = "/var/1C/licenses"
    File = "/var/www"
    File = "/etc/apache2"
    File = "/opt/1cv8/conf"
  }
}
petav ★★★★★
() автор топика

Обнаружено, что запись «\w{8,15}-\S{4}-\S{4}-\S{4}-\S{12}» интерпретируется Bacula как:

w{8,15}-S{4}-S{4}-S{4}-S{12}

How-to Тестирование fileset Bacula

1) Конфигурационный файл


# cat /etc/bacula/conf.d/fileset/1cv8-files.conf 
Fileset {
  Name = 1cv8-files
  Include {
    Options {
      RegexDir = "\\w{8,15}-\\S{4}-\\S{4}-\\S{4}-\\S{12}"
      Exclude = yes
    }
    Options {
      RegexDir = "logs"
      Exclude = yes
    }
    File = "/home/usr1cv8/.1cv8"
    File = "/var/1C/licenses"
    File = "/var/www"
    File = "/etc/apache2"
    File = "/opt/1cv8/conf"
  }
}
# 

2) Обновление конфигурации

systemctl reload bacula-dir
Новые сущности не создаются, только обновляются прежние!? 3) Представление bacula о fileset
FileSet: name=1cv8-files IgnoreFileSetChanges=0
      O e
      RD \w{8,15}-\S{4}-\S{4}-\S{4}-\S{12}
      N
      O e
      RD logs
      N
      I /home/usr1cv8/.1cv8
      I /var/1C/licenses
      I /var/www
      I /etc/apache2
      I /opt/1cv8/conf
      N
You have messages.
4) Оценка fileset
*estimate job=1cv8-files fileset=1cv8-files client=1cv8 listing
Using Catalog "bacula"
Connecting to Client 1cv8 at 1cv8:9102
-rw-r-----   1 usr1cv8  grp1cv8                 524 2024-04-01 09:35:07  /home/usr1cv8/.1cv8/1C/1cv8/1cv8wsrv.lst
...
drwxr-xr-x   2 root     root                   4096 2024-04-21 04:42:27  /opt/1cv8/conf
2000 OK estimate files=263 bytes=426,119
*

petav ★★★★★
() автор топика
Последнее исправление: petav (всего исправлений: 1)

Отладка regexp (при наличии)

Put list directory to 1.list (on client)

root@1cv8:/home/usr1cv8/.1cv8/1C/1cv8# ls -l > /tmp/1.list
root@1cv8:/home/usr1cv8/.1cv8/1C/1cv8# 

Test regexp on content 1.list (on bacula-dir)

~# bregex -f /tmp/1.list 
Enter regex pattern: \w{8,15}-\S{4}-\S{4}-\S{4}-\S{12}
    1: /home/usr1cv8/.1cv8/1C/1cv8/08410b14-a2f7-454b-92de-ab91808b77f3
    2: /home/usr1cv8/.1cv8/1C/1cv8/111f29b5-b0d4-481b-a691-c0ad9b5dfa1d
    3: /home/usr1cv8/.1cv8/1C/1cv8/114885d7-67d2-41f5-8c68-5532f1240293
    4: /home/usr1cv8/.1cv8/1C/1cv8/19bdf6ce-189e-4630-9362-0d12190c87fa
    8: /home/usr1cv8/.1cv8/1C/1cv8/210dc968-e03d-4a8c-8e93-ccbeaa0e7a49
    9: /home/usr1cv8/.1cv8/1C/1cv8/21e2e863-1ac0-4607-8335-bc63aaa86187
   10: /home/usr1cv8/.1cv8/1C/1cv8/2f112e3c-3b7f-4b3b-a464-24be45066c8f
   11: /home/usr1cv8/.1cv8/1C/1cv8/2fc630dc-1bb5-4b9c-9e03-579ac34beb48
   12: /home/usr1cv8/.1cv8/1C/1cv8/3027a763-a3ef-4185-a850-5c9e7b00353b
   13: /home/usr1cv8/.1cv8/1C/1cv8/312aab3e-60b6-47ef-ab96-eb5c5183bae3
   14: /home/usr1cv8/.1cv8/1C/1cv8/39fb3f6f-c6b9-4f4b-a6e4-d764c7f6ef92
   15: /home/usr1cv8/.1cv8/1C/1cv8/42f78e52-ae4c-4075-83b0-7a3f1ec44ccf
   16: /home/usr1cv8/.1cv8/1C/1cv8/48d1b5b1-8d07-4877-8b24-f2631d3feb33
   17: /home/usr1cv8/.1cv8/1C/1cv8/4a6d8323-ee4f-419c-a0f4-93bc356c7db9
   18: /home/usr1cv8/.1cv8/1C/1cv8/4a7e0678-33c5-4bae-8134-3a5eb032336b
   19: /home/usr1cv8/.1cv8/1C/1cv8/6a0ec55c-117e-41b8-bfa9-7ac743beb81e
   20: /home/usr1cv8/.1cv8/1C/1cv8/7140926a-465e-4a88-becd-fdb128aeab7c
   21: /home/usr1cv8/.1cv8/1C/1cv8/72ade77e-95ec-4e49-b643-77df4223a827
   22: /home/usr1cv8/.1cv8/1C/1cv8/72f45430-3c32-4962-a00d-9455c69d2678
   23: /home/usr1cv8/.1cv8/1C/1cv8/9e121229-85d7-4d00-8b16-ec55034fa2c3
   24: /home/usr1cv8/.1cv8/1C/1cv8/9e41e607-908c-49af-9865-f72e6ea6ec24
   25: /home/usr1cv8/.1cv8/1C/1cv8/9f087a2a-0fd5-425e-a1f1-b2f102e84839
   26: /home/usr1cv8/.1cv8/1C/1cv8/a2dfd0be-4f63-4c37-b534-884d7e2028d9
   27: /home/usr1cv8/.1cv8/1C/1cv8/a98700e1-2137-4d16-9145-1769d07ee49f
   28: /home/usr1cv8/.1cv8/1C/1cv8/aa6af1ed-49e9-49d5-b2bf-49c0e7516d2b
   29: /home/usr1cv8/.1cv8/1C/1cv8/c1accc46-aa6c-4c83-bb0f-4b9562eb7c21
   30: /home/usr1cv8/.1cv8/1C/1cv8/cb0588d4-56ac-451d-bce8-9aa5069b0e53
   31: /home/usr1cv8/.1cv8/1C/1cv8/d0a482e8-3c2a-40e1-8df6-14b9f5afc2f1
   32: /home/usr1cv8/.1cv8/1C/1cv8/d46c2ab3-4983-4aa3-9392-a0d6872eea4f
   33: /home/usr1cv8/.1cv8/1C/1cv8/f3d9437b-0ea9-482e-b9c5-677d60e299e9
   34: /home/usr1cv8/.1cv8/1C/1cv8/f75e1738-9a71-4f8e-962c-6dfdefd818ea
   35: /home/usr1cv8/.1cv8/1C/1cv8/f84a22e8-950f-4175-8748-d02123a1f0f0
Enter regex pattern: 
~#

petav ★★★★★
() автор топика