BLOG

SYSLOG_NG change date format and send to mysql

Nastavenie casu aky sa ma logovat, posielat do MYSQL..

Nastavenie datumovych premenych:

Date-related macros

template and rewrite: Format, modify, and manipulate log messages > Customize message format using macros and templates > Date-related macros

The macros related to the date of the message (for example: ${ISODATE}, ${HOUR}, and so on) have three further variants each:

  • S_ prefix, for example, ${S_DATE}: The ${S_DATE} macro represents the date found in the log message, that is, when the message was sent by the original application. Caution: To use the S_ macros, the keep-timestamp() option must be enabled (this is the default behavior of syslog-ng OSE).
  • R_ prefix, for example, ${R_DATE}: ${R_DATE} is the date when syslog-ng OSE has received the message.
  • C_ prefix, for example, ${C_DATE}: ${C_DATE} is the current date, that is when syslog-ng OSE processes the message and resolves the macro.

The ${DATE} macro equals the ${S_DATE} macro.

The values of the date-related macros are calculated using the original timezone information of the message. To convert it to a different timezone, use the time-zone() option. You can set the time-zone() option as a global option, or per destination. For sources, it applies only if the original message does not contain timezone information. Converting the timezone changes the values of the following date-related macros (macros MSEC and USEC are not changed):

  • AMPM
  • DATE
  • DAY
  • FULLDATE
  • HOUR
  • HOUR12
  • ISODATE
  • MIN
  • MONTH
  • MONTH_ABBREV
  • MONTH_NAME
  • MONTH_WEEK
  • SEC
  • STAMP
  • TZ
  • TZOFFSET
  • UNIXTIME
  • WEEK
  • WEEK_DAY
  • WEEK_DAY_ABBREV
  • WEEK_DAY_NAME
  • YEAR
  • YEAR_DAY

Zdroj:

https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.18/administration-guide/60

nastavenie logovania do MYSQL

destination d_mysql_vala {


sql(
type(mysql)
host("192.168.191.21")
username("syslogadmin")
password("remotelog")
database("lmsfin")
table("logs")
columns("host", "facility", "priority", "level", "tag", "date", "time", "program", "msg")
#values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG","$YEAR-$MONTH-$DAY", "$HOUR:$MIN:$SEC","$PROGRAM", "$MSG")
values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG","$C_YEAR-$C_MONTH-$C_DAY", "$C_HOUR:$C_MIN:$C_SEC","$PROGRAM", "$MSG")

indexes("datetime", "host", "program", "msg")
);



    };
   Send article as PDF   
10. júla 2020 Linux
Žiadne komentáre

CIsco WLC (airOS) disable logging console

Check_mk windows agent plugin run frequency

Pridaj komentár Zrušiť odpoveď

6  +  1  =  

Najnovšie články

  • Windows server 2022 printer add 16. septembra 2024
  • Elasticsearch docker ssl 27. júla 2024
  • Azure AuditEnterpriseAppsAzure 7. júla 2024
  • MSSQL server create external account from entra ID 20. marca 2024
  • ubuntu bring up all interface and show actual speed 17. januára 2024
  • RDP password BruteForce 12. decembra 2023
  • CiscoUCS 6XXX reboot 10. júna 2023

Najnovšie komentáre

  • Róbert Čečetka komentoval Zobrazenie všetkých stĺpcov z MYSQL cez PHP a html

Archív

  • september 2024
  • júl 2024
  • marec 2024
  • január 2024
  • december 2023
  • jún 2023
  • máj 2023
  • marec 2023
  • december 2022
  • október 2022
  • august 2022
  • júl 2022
  • máj 2022
  • apríl 2022
  • marec 2022
  • október 2021
  • september 2021
  • august 2021
  • jún 2021
  • máj 2021
  • apríl 2021
  • marec 2021
  • február 2021
  • január 2021
  • december 2020
  • november 2020
  • október 2020
  • september 2020
  • august 2020
  • júl 2020
  • jún 2020
  • máj 2020
  • apríl 2020
  • marec 2020
  • február 2020
  • január 2020
  • december 2019

Kategórie

  • Active Directory (3)
  • Ansible (1)
  • apereo (3)
  • BIaKS (2)
  • checkpoint (4)
  • CISCO (40)
  • docker (4)
  • emby (2)
  • freeradius (7)
  • Lenovo-IBM (1)
  • Linux (79)
  • Mikrotik (2)
  • monitoring (34)
  • Nezaradené (24)
  • PLESK (3)
  • Programovanie (13)
  • VEEAM (2)
  • VMware (38)
  • Windows (17)
  • Zabezpecenie (5)

Meta

  • Prihlásiť sa
  • Feed záznamov
  • RSS feed komentárov
  • WordPress.org
Hrdo poháňa WordPress | Téma: Neblue od NEThemes.