Export Transactions

my original file;

#!/bin/bash

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

if [ -z "$1" ]; then
        ADAYAGO=`date --date="1 day ago" +%Y-%m-%d`
else
        ADAYAGO="$1"
fi

echo "Starting $ADAYAGO"
QUERY_STR='{"query":{"range":{"timestamp":{"gte":"'"$ADAYAGO "'00:00:00.000","lte":"'"$ADAYAGO"' 23:59:59.999"}}}}'
EXPORT_PATH=/home/sgeuser/elasticsearch
EXPORT_FILE_NAME=esbackup.$ADAYAGO.json
es-export-bulk --url http://localhost:9200 --file $EXPORT_PATH/$EXPORT_FILE_NAME --body "$QUERY_STR"
ls -lh $EXPORT_PATH/$EXPORT_FILE_NAME
gzip -9 $EXPORT_PATH/$EXPORT_FILE_NAME
md5sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz > $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash
sha1sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz >> $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash
sha256sum $EXPORT_PATH/$EXPORT_FILE_NAME.gz >> $EXPORT_PATH/$EXPORT_FILE_NAME.gz.hash

es-export-bulk --url http://localhost:9200 --file $EXPORT_PATH/$EXPORT_FILE_NAME --body “$QUERY_STR”

it gives an error

es-export-bulk --url http://localhost:9200 --file $EXPORT_PATH/$EXPORT_FILE_NAME --body "$QUERY_STR"
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EISDIR: illegal operation on a directory, open '/'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at Object.<anonymous> (/usr/local/lib/node_modules/elasticsearch-tools/lib/es-export-bulk.js:279:6)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)

I am getting error while exporting

can you help?

Hello,

How is the permission on those directory’s, Can the bash file access them?

I have been given permissions. I didn’t write the jeans, A command line that worked 2 years ago in those versions, but it doesn’t work anymore
Why?

This is not really a Graylog question, it looks like Elasticsearch and related tools - you may have better luck in the Elasticsearch forums.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.