When I use im_file and om_odbc,from the log,I get this message:WARNING SQLExecDirect failed; HY000:1:0:[Devart][ODBC][PostgreSQL]在字段 "timestamp" 中空值违反了非空约束
<Input in>
Module im_file
File "C:\\Users\\jiang.dengjie\\Desktop\\log1.txt"
ReadFromLast False
SavePos False
if $raw_event =~ /^(\w+ \d+ \S+ \S+) (\S+) (\S+):(.+)$/
$timestamp = $1;
$hostname = $2;
$eventname = $3;
$event = $4;
# Exec parse_syslog();
<Output out>
Module om_odbc
ConnectionString Driver={Devart ODBC Driver for PostgreSQL}; Server=; \
UID=qytangdbuser; PWD=Cisc0123; Database=qytangdb
SQL "INSERT INTO qytdb_network_log (timestamp, hostname, eventname, event) VALUES (?,?,?,?)",$timestamp,$hostname,$eventname,$event
#<Output out>
# Module om_file
# File "C:\\Users\\jiang.dengjie\\Desktop\\logtest.txt"
# Exec to_json();
<Route r>
Path in => out
In my file:
%Feb 5 15:47:32:118 2015 trust-access IFNET/5/LINK_UPDOWN: Line protocol on the interface GigabitEthernet1/0/41 is down.
%Feb 5 15:47:35:367 2015 trust-access IFNET/3/PHY_UPDOWN: GigabitEthernet1/0/40 link status is up.
And I want to use nxlog to save this file to my pgsql which has the table that has five colum:id,timestamp,hostname,eventname,event.
Also if any viedo about how to use nxlog?
Thank you very much.

AskedJune 11, 2019 - 4:06am

Answer (1)

Hello! I had to use google translate for the error message, so I hope it did a good job :)
It seems like the timestamp value is null going into the database. I think the type may be wrong.
You may want to do something like $timestamp = parsedate($1);

As for videos, we do not have any official how-to videos, but there are some on YouTube.
The Manual is pretty large, but it has a lot of good information and most have config snippets that you can copy and paste.
Feel free to ask any questions in the forum. A lot of our integrations are in the manual as well.

AnsweredJune 12, 2019 - 2:00am