{"action":"created","comment":{"url":"https://api.github.com/repos/inliniac/suricata/pulls/comments/84103600","pull_request_review_id":4893378,"id":84103600,"diff_hunk":"@@ -538,19 +766,62 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx)\n }\n \n #ifdef HAVE_LIBHIREDIS\n-static int  LogFileWriteRedis(LogFileCtx *file_ctx, const char *string, size_t string_len)\n+\n+/**\n+ * \\brief LogFileWriteRedis() writes log data to redis output.\n+ * \\param log_ctx Log file context allocated by caller\n+ * \\param string buffer with data to write\n+ * \\param string_len data length\n+ * \\retval 0 on sucess;\n+ * \\retval -1 on failure;\n+ */\n+static int LogFileWriteRedis(LogFileCtx *file_ctx, const char *string, size_t string_len)\n {\n     if (file_ctx->redis == NULL) {\n         SCConfLogReopenRedis(file_ctx);\n         if (file_ctx->redis == NULL) {\n             return -1;\n         } else {\n-            SCLogInfo(\"Reconnected to redis server\");\n+            SCLogInfo(\"Reconnected to redis server.\");\n         }\n     }\n-    /* TODO go async here ? */\n+\n+\tSCLogRedisContext * ctx = file_ctx->redis;\n+\n+#if HAVE_LIBEVENT == 1\n+\t/* async mode on */\n+    if (file_ctx->redis_setup.async) {\n+\n+        redisAsyncContext * redis_async = ctx->async;\n+\n+        if (redis_async) {\n+            SCLogDebug(\"redis async command: %s\", file_ctx->redis_setup.command);\n+            redisAsyncCommand(redis_async,\n+                    SCRedisAsyncCommandCallback,\n+                    file_ctx,\n+                    \"%s %s %s\",\n+                    file_ctx->redis_setup.command,\n+                    file_ctx->redis_setup.key,\n+                    string);\n+\n+            redisAsyncHandleWrite(redis_async);\n+            redisAsyncHandleRead(redis_async);\n+\n+        }\n+        return 0;\n+    }\n+#endif","path":"src/util-logopenfile.c","position":460,"original_position":460,"commit_id":"9a8b27b1970bdbc52da2b00af2e520fc74303bba","original_commit_id":"9ffd0ccdab114fa2a6abc1deffd849d46f9dca36","user":{"login":"regit","id":308616,"avatar_url":"https://avatars.githubusercontent.com/u/308616?v=3","gravatar_id":"","url":"https://api.github.com/users/regit","html_url":"https://github.com/regit","followers_url":"https://api.github.com/users/regit/followers","following_url":"https://api.github.com/users/regit/following{/other_user}","gists_url":"https://api.github.com/users/regit/gists{/gist_id}","starred_url":"https://api.github.com/users/regit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/regit/subscriptions","organizations_url":"https://api.github.com/users/regit/orgs","repos_url":"https://api.github.com/users/regit/repos","events_url":"https://api.github.com/users/regit/events{/privacy}","received_events_url":"https://api.github.com/users/regit/received_events","type":"User","site_admin":false},"body":"This construct is not nice. It would be better to have an async and a sync function defined inline and then call them in a nice if else construct.","created_at":"2016-10-19T15:54:31Z","updated_at":"2016-10-19T16:01:08Z","html_url":"https://github.com/inliniac/suricata/pull/2362#discussion_r84103600","pull_request_url":"https://api.github.com/repos/inliniac/suricata/pulls/2362","_links":{"self":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/comments/84103600"},"html":{"href":"https://github.com/inliniac/suricata/pull/2362#discussion_r84103600"},"pull_request":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/2362"}}},"pull_request":{"url":"https://api.github.com/repos/inliniac/suricata/pulls/2362","id":89532295,"html_url":"https://github.com/inliniac/suricata/pull/2362","diff_url":"https://github.com/inliniac/suricata/pull/2362.diff","patch_url":"https://github.com/inliniac/suricata/pull/2362.patch","issue_url":"https://api.github.com/repos/inliniac/suricata/issues/2362","number":2362,"state":"open","locked":false,"title":"Dev eve output redis async","user":{"login":"fooinha","id":8560528,"avatar_url":"https://avatars.githubusercontent.com/u/8560528?v=3","gravatar_id":"","url":"https://api.github.com/users/fooinha","html_url":"https://github.com/fooinha","followers_url":"https://api.github.com/users/fooinha/followers","following_url":"https://api.github.com/users/fooinha/following{/other_user}","gists_url":"https://api.github.com/users/fooinha/gists{/gist_id}","starred_url":"https://api.github.com/users/fooinha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fooinha/subscriptions","organizations_url":"https://api.github.com/users/fooinha/orgs","repos_url":"https://api.github.com/users/fooinha/repos","events_url":"https://api.github.com/users/fooinha/events{/privacy}","received_events_url":"https://api.github.com/users/fooinha/received_events","type":"User","site_admin":false},"body":"Initial support for reading redis replies asynchronously.\r\nThe libevent adapter for the hiredis async API is used.\r\n\r\nSubmission for review. @jasonish \r\n\r\nCommand pipelining for the async: true mode is not implemented, and it only will be added after discussion and review. \r\n\r\nThanx","created_at":"2016-10-16T17:24:30Z","updated_at":"2016-10-19T16:01:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f5c6de95e2ec5740f0e40ac5ec69c68aafb6704","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/inliniac/suricata/pulls/2362/commits","review_comments_url":"https://api.github.com/repos/inliniac/suricata/pulls/2362/comments","review_comment_url":"https://api.github.com/repos/inliniac/suricata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inliniac/suricata/issues/2362/comments","statuses_url":"https://api.github.com/repos/inliniac/suricata/statuses/9a8b27b1970bdbc52da2b00af2e520fc74303bba","head":{"label":"fooinha:dev-eve-output-redis-async","ref":"dev-eve-output-redis-async","sha":"9a8b27b1970bdbc52da2b00af2e520fc74303bba","user":{"login":"fooinha","id":8560528,"avatar_url":"https://avatars.githubusercontent.com/u/8560528?v=3","gravatar_id":"","url":"https://api.github.com/users/fooinha","html_url":"https://github.com/fooinha","followers_url":"https://api.github.com/users/fooinha/followers","following_url":"https://api.github.com/users/fooinha/following{/other_user}","gists_url":"https://api.github.com/users/fooinha/gists{/gist_id}","starred_url":"https://api.github.com/users/fooinha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fooinha/subscriptions","organizations_url":"https://api.github.com/users/fooinha/orgs","repos_url":"https://api.github.com/users/fooinha/repos","events_url":"https://api.github.com/users/fooinha/events{/privacy}","received_events_url":"https://api.github.com/users/fooinha/received_events","type":"User","site_admin":false},"repo":{"id":67021149,"name":"suricata","full_name":"fooinha/suricata","owner":{"login":"fooinha","id":8560528,"avatar_url":"https://avatars.githubusercontent.com/u/8560528?v=3","gravatar_id":"","url":"https://api.github.com/users/fooinha","html_url":"https://github.com/fooinha","followers_url":"https://api.github.com/users/fooinha/followers","following_url":"https://api.github.com/users/fooinha/following{/other_user}","gists_url":"https://api.github.com/users/fooinha/gists{/gist_id}","starred_url":"https://api.github.com/users/fooinha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fooinha/subscriptions","organizations_url":"https://api.github.com/users/fooinha/orgs","repos_url":"https://api.github.com/users/fooinha/repos","events_url":"https://api.github.com/users/fooinha/events{/privacy}","received_events_url":"https://api.github.com/users/fooinha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fooinha/suricata","description":"Mirror of the official OISF Suricata git repository","fork":true,"url":"https://api.github.com/repos/fooinha/suricata","forks_url":"https://api.github.com/repos/fooinha/suricata/forks","keys_url":"https://api.github.com/repos/fooinha/suricata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fooinha/suricata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fooinha/suricata/teams","hooks_url":"https://api.github.com/repos/fooinha/suricata/hooks","issue_events_url":"https://api.github.com/repos/fooinha/suricata/issues/events{/number}","events_url":"https://api.github.com/repos/fooinha/suricata/events","assignees_url":"https://api.github.com/repos/fooinha/suricata/assignees{/user}","branches_url":"https://api.github.com/repos/fooinha/suricata/branches{/branch}","tags_url":"https://api.github.com/repos/fooinha/suricata/tags","blobs_url":"https://api.github.com/repos/fooinha/suricata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fooinha/suricata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fooinha/suricata/git/refs{/sha}","trees_url":"https://api.github.com/repos/fooinha/suricata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fooinha/suricata/statuses/{sha}","languages_url":"https://api.github.com/repos/fooinha/suricata/languages","stargazers_url":"https://api.github.com/repos/fooinha/suricata/stargazers","contributors_url":"https://api.github.com/repos/fooinha/suricata/contributors","subscribers_url":"https://api.github.com/repos/fooinha/suricata/subscribers","subscription_url":"https://api.github.com/repos/fooinha/suricata/subscription","commits_url":"https://api.github.com/repos/fooinha/suricata/commits{/sha}","git_commits_url":"https://api.github.com/repos/fooinha/suricata/git/commits{/sha}","comments_url":"https://api.github.com/repos/fooinha/suricata/comments{/number}","issue_comment_url":"https://api.github.com/repos/fooinha/suricata/issues/comments{/number}","contents_url":"https://api.github.com/repos/fooinha/suricata/contents/{+path}","compare_url":"https://api.github.com/repos/fooinha/suricata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fooinha/suricata/merges","archive_url":"https://api.github.com/repos/fooinha/suricata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fooinha/suricata/downloads","issues_url":"https://api.github.com/repos/fooinha/suricata/issues{/number}","pulls_url":"https://api.github.com/repos/fooinha/suricata/pulls{/number}","milestones_url":"https://api.github.com/repos/fooinha/suricata/milestones{/number}","notifications_url":"https://api.github.com/repos/fooinha/suricata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fooinha/suricata/labels{/name}","releases_url":"https://api.github.com/repos/fooinha/suricata/releases{/id}","deployments_url":"https://api.github.com/repos/fooinha/suricata/deployments","created_at":"2016-08-31T08:58:27Z","updated_at":"2016-08-31T08:58:32Z","pushed_at":"2016-10-18T21:58:55Z","git_url":"git://github.com/fooinha/suricata.git","ssh_url":"git@github.com:fooinha/suricata.git","clone_url":"https://github.com/fooinha/suricata.git","svn_url":"https://github.com/fooinha/suricata","homepage":"http://suricata-ids.org/","size":32597,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inliniac:master","ref":"master","sha":"1aa70fb39e5581956cef99cc4ac3daef80e0454e","user":{"login":"inliniac","id":719366,"avatar_url":"https://avatars.githubusercontent.com/u/719366?v=3","gravatar_id":"","url":"https://api.github.com/users/inliniac","html_url":"https://github.com/inliniac","followers_url":"https://api.github.com/users/inliniac/followers","following_url":"https://api.github.com/users/inliniac/following{/other_user}","gists_url":"https://api.github.com/users/inliniac/gists{/gist_id}","starred_url":"https://api.github.com/users/inliniac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inliniac/subscriptions","organizations_url":"https://api.github.com/users/inliniac/orgs","repos_url":"https://api.github.com/users/inliniac/repos","events_url":"https://api.github.com/users/inliniac/events{/privacy}","received_events_url":"https://api.github.com/users/inliniac/received_events","type":"User","site_admin":false},"repo":{"id":5410234,"name":"suricata","full_name":"inliniac/suricata","owner":{"login":"inliniac","id":719366,"avatar_url":"https://avatars.githubusercontent.com/u/719366?v=3","gravatar_id":"","url":"https://api.github.com/users/inliniac","html_url":"https://github.com/inliniac","followers_url":"https://api.github.com/users/inliniac/followers","following_url":"https://api.github.com/users/inliniac/following{/other_user}","gists_url":"https://api.github.com/users/inliniac/gists{/gist_id}","starred_url":"https://api.github.com/users/inliniac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inliniac/subscriptions","organizations_url":"https://api.github.com/users/inliniac/orgs","repos_url":"https://api.github.com/users/inliniac/repos","events_url":"https://api.github.com/users/inliniac/events{/privacy}","received_events_url":"https://api.github.com/users/inliniac/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/inliniac/suricata","description":"Mirror of the official OISF Suricata git repository","fork":false,"url":"https://api.github.com/repos/inliniac/suricata","forks_url":"https://api.github.com/repos/inliniac/suricata/forks","keys_url":"https://api.github.com/repos/inliniac/suricata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inliniac/suricata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inliniac/suricata/teams","hooks_url":"https://api.github.com/repos/inliniac/suricata/hooks","issue_events_url":"https://api.github.com/repos/inliniac/suricata/issues/events{/number}","events_url":"https://api.github.com/repos/inliniac/suricata/events","assignees_url":"https://api.github.com/repos/inliniac/suricata/assignees{/user}","branches_url":"https://api.github.com/repos/inliniac/suricata/branches{/branch}","tags_url":"https://api.github.com/repos/inliniac/suricata/tags","blobs_url":"https://api.github.com/repos/inliniac/suricata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inliniac/suricata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inliniac/suricata/git/refs{/sha}","trees_url":"https://api.github.com/repos/inliniac/suricata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inliniac/suricata/statuses/{sha}","languages_url":"https://api.github.com/repos/inliniac/suricata/languages","stargazers_url":"https://api.github.com/repos/inliniac/suricata/stargazers","contributors_url":"https://api.github.com/repos/inliniac/suricata/contributors","subscribers_url":"https://api.github.com/repos/inliniac/suricata/subscribers","subscription_url":"https://api.github.com/repos/inliniac/suricata/subscription","commits_url":"https://api.github.com/repos/inliniac/suricata/commits{/sha}","git_commits_url":"https://api.github.com/repos/inliniac/suricata/git/commits{/sha}","comments_url":"https://api.github.com/repos/inliniac/suricata/comments{/number}","issue_comment_url":"https://api.github.com/repos/inliniac/suricata/issues/comments{/number}","contents_url":"https://api.github.com/repos/inliniac/suricata/contents/{+path}","compare_url":"https://api.github.com/repos/inliniac/suricata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inliniac/suricata/merges","archive_url":"https://api.github.com/repos/inliniac/suricata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inliniac/suricata/downloads","issues_url":"https://api.github.com/repos/inliniac/suricata/issues{/number}","pulls_url":"https://api.github.com/repos/inliniac/suricata/pulls{/number}","milestones_url":"https://api.github.com/repos/inliniac/suricata/milestones{/number}","notifications_url":"https://api.github.com/repos/inliniac/suricata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inliniac/suricata/labels{/name}","releases_url":"https://api.github.com/repos/inliniac/suricata/releases{/id}","deployments_url":"https://api.github.com/repos/inliniac/suricata/deployments","created_at":"2012-08-14T08:30:06Z","updated_at":"2016-10-16T09:38:46Z","pushed_at":"2016-10-19T15:27:30Z","git_url":"git://github.com/inliniac/suricata.git","ssh_url":"git@github.com:inliniac/suricata.git","clone_url":"https://github.com/inliniac/suricata.git","svn_url":"https://github.com/inliniac/suricata","homepage":"http://suricata-ids.org/","size":52825,"stargazers_count":313,"watchers_count":313,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":282,"mirror_url":null,"open_issues_count":20,"forks":282,"open_issues":20,"watchers":313,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/2362"},"html":{"href":"https://github.com/inliniac/suricata/pull/2362"},"issue":{"href":"https://api.github.com/repos/inliniac/suricata/issues/2362"},"comments":{"href":"https://api.github.com/repos/inliniac/suricata/issues/2362/comments"},"review_comments":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/2362/comments"},"review_comment":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inliniac/suricata/pulls/2362/commits"},"statuses":{"href":"https://api.github.com/repos/inliniac/suricata/statuses/9a8b27b1970bdbc52da2b00af2e520fc74303bba"}}}}
{"actor":{"display_login":"regit"}}