Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty parameter value incorrectly interpreted as empty string, leading to bot failures #294

Open
yper3 opened this issue Mar 22, 2023 · 10 comments
Labels

Comments

@yper3
Copy link

yper3 commented Mar 22, 2023

Hello,

I have problems with the postgres SQL BOT:

2023-03-22 05:27:37,073 - SQL-Output - INFO - Bot will continue in 15 seconds.
2023-03-22 05:27:52,125 - SQL-Output - ERROR - Bot has found a problem.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/intelmq/lib/bot.py", line 319, in start
self.process()
File "/usr/lib/python3/dist-packages/intelmq/bots/outputs/sql/output.py", line 56, in process
if self.execute(query, values, rollback=True):
File "/usr/lib/python3/dist-packages/intelmq/lib/mixins/sql.py", line 115, in execute
self.cur.execute(query, values)
psycopg2.errors.SyntaxError: zero-length delimited identifier at or near """"
LINE 1: INSERT INTO events ("") VALUES ()
^

Do you know what can be?

Thanks!!!

@sebix
Copy link
Member

sebix commented Mar 22, 2023

Is that event probably empty?

@yper3
Copy link
Author

yper3 commented Mar 22, 2023

It happens with any event. when you configured the output to postgres. for which when inserting into the Query there is a blank column.

I have configured postgres following the guide and it has not been able to work due to this error, even when it is connected and the girl database is created

@sebix sebix added the bug label Mar 22, 2023
@sebix
Copy link
Member

sebix commented Mar 22, 2023

Can you please show the configuration parameters of the SQL-Output bot and show the output of intelmqctl run SQL-Output message get?

@yper3
Copy link
Author

yper3 commented Mar 23, 2023

Can you please show the configuration parameters of the SQL-Output bot and show the output of intelmqctl run SQL-Output message get?

SQL-Output: Bot has found a problem.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/intelmq/lib/bot.py", line 319, in start
self.process()
File "/usr/lib/python3/dist-packages/intelmq/bots/outputs/sql/output.py", line 56, in process
if self.execute(query, values, rollback=True):
File "/usr/lib/python3/dist-packages/intelmq/lib/mixins/sql.py", line 115, in execute
self.cur.execute(query, values)
psycopg2.errors.SyntaxError: zero-length delimited identifier at or near """"
LINE 1: INSERT INTO events ("") VALUES ()
^
SQL-Output: Dumping message to dump file.

@yper3
Copy link
Author

yper3 commented Mar 23, 2023

This is the configuration for Bot

SQL-Output:
bot_id: SQL-Output
description: Send events to a PostgreSQL or SQLite database
enabled: true
group: Output
module: intelmq.bots.outputs.sql.output
name: SQL
parameters:
autocommit: true
bottype: Output
database: intelmq-events
destination_queues: {}
engine: postgresql
fields: ''
host: xx.159.xx.xx
jsondict_as_string: true
message_jsondict_as_string: true
password: ****
port: 5432
reconnect_delay: 0
sslmode: require
table: events
user: intelmq
run_mode: continuous

@sebix
Copy link
Member

sebix commented Mar 23, 2023

Why is fields an empty string? Does it work if you set it to null/empty/remove it?

@yper3
Copy link
Author

yper3 commented Mar 23, 2023

thank you. I am going to try. the configuration was done from the web interface.

@yper3
Copy link
Author

yper3 commented Mar 23, 2023

Hello!!!

It has worked. The error is when you make a change from intelmq-manager (web) and save it. Add the field value "", totally remove "field" from cli and it works. But if you modify it again from web it writes it again.

@yper3
Copy link
Author

yper3 commented Mar 23, 2023

The problem maybe are in intelmq-manager...

@sebix
Copy link
Member

sebix commented Mar 23, 2023

Yeah, the manager is not good at getting the types correctly

@sebix sebix transferred this issue from certtools/intelmq Mar 23, 2023
@sebix sebix changed the title SQL Output Postgress Error Empty parameter value incorrectly interpreted as empty string, leading to bot failures Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants